org.openrdf.util.http
Class FilePart

java.lang.Object
  extended byorg.openrdf.util.http.FilePart

public class FilePart
extends Object

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()
           
 int size()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FilePart

public FilePart(String name,
                String contentType,
                byte[] contents)
Construct a new filepart. Content type defaults to "application/octet-stream" if not specified.

Method Detail

getInputStream

public InputStream getInputStream()
                           throws IOException
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()
Returns:
the content type of the uploaded file as determined from the request, or the filename extension.

getName

public String getName()
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.


Copyright © 2002-2006 Aduna BV, GNU LGPL License applies.