info.aduna.webapp.util
Class FilePart

java.lang.Object
  extended by info.aduna.webapp.util.FilePart
All Implemented Interfaces:
javax.activation.DataSource

public class FilePart
extends Object
implements javax.activation.DataSource

FilePart represents a file uploaded through a multipart/form-data encoded POST request.


Constructor Summary
FilePart(String name, String contentType, byte[] contents)
          Construct a new filepart.
 
Method Summary
 byte[] getBytes()
           
 String getContentType()
           
 InputStream getInputStream()
           
 String getName()
           
 OutputStream getOutputStream()
           
 int size()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FilePart

public FilePart(String name,
                String contentType,
                byte[] contents)
Construct a new filepart.

Method Detail

getInputStream

public InputStream getInputStream()
                           throws IOException
Specified by:
getInputStream in interface javax.activation.DataSource
Returns:
an InputStream on the contents of the file. Note: a new stream is returned each time.
Throws:
IOException

size

public int size()

getContentType

public String getContentType()
Specified by:
getContentType in interface javax.activation.DataSource
Returns:
the content type of the uploaded file as determined from the request, or the filename extension.

getName

public String getName()
Specified by:
getName in interface javax.activation.DataSource
Returns:
the name of the uploaded file as specified in the request.

getBytes

public byte[] getBytes()
Returns:
the contents of the uploaded file as specified in the request.

getOutputStream

public OutputStream getOutputStream()
                             throws IOException
Specified by:
getOutputStream in interface javax.activation.DataSource
Throws:
IOException


Copyright © 1997-2008 Aduna. All Rights Reserved.