All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class nl.nmg.servlet.UploadedFile

java.lang.Object
   |
   +----nl.nmg.servlet.UploadedFile

public class UploadedFile
extends Object
The UploadedFile class represents files uploaded with a multipart/form-data form. The files are stored either in memory or on disk. UploadedFile objects are returned by ExtendedRequest.getFileParameter().

See Also:
getFileParameter, getFileParameterValues

Method Index

 o deleteTemporaryFile()
Deletes any temporary file associated with this uploaded file.
 o getBytes()
Returns the contents as a byte array.
 o getContentFilename()
Returns the client-side filename of the uploaded file or null if unknown.
 o getContentFullFilename()
Returns the full client-side filename of the uploaded file as it was sent to the server or null if unknown.
 o getContentLength()
Returns the length of the file.
 o getContentType()
Returns the content-type of the file or null if unknown.
 o getInputStream()
Creates an InputStream that can be used to read the contents of the uploaded file.
 o getReader()
Creates a Reader that can be used to read the contents of the uploaded file.
 o getTemporaryFile()
Returns a handle to the temporary file that stores the uploaded file.
 o toString()
Returns the full client-side filename of the uploaded file.

Methods

 o getContentType
 public String getContentType()
Returns the content-type of the file or null if unknown. Some browsers don't send content-types for plain text files.

Returns:
the content-type
 o getContentLength
 public int getContentLength()
Returns the length of the file. This is the actual length, not the value of a header.

Returns:
the length
 o getContentFilename
 public String getContentFilename()
Returns the client-side filename of the uploaded file or null if unknown. If the filename contains backslashes or forward slashes, only the part after the last slash is returned.

Returns:
the useful part of the client-side filename
 o getContentFullFilename
 public String getContentFullFilename()
Returns the full client-side filename of the uploaded file as it was sent to the server or null if unknown.

Returns:
the full client-side filename
 o getInputStream
 public InputStream getInputStream() throws IOException
Creates an InputStream that can be used to read the contents of the uploaded file.

Returns:
an InputStream for the contents
 o getReader
 public Reader getReader() throws IOException
Creates a Reader that can be used to read the contents of the uploaded file.

Returns:
a Reader for the contents
 o getBytes
 public byte[] getBytes()
Returns the contents as a byte array. If the uploaded file has been stored in a temporary file, the file is read to get the complete contents.

Returns:
the contents of the uploaded file
Throws: IllegalStateException
when an IOException occurred while reading the temporary file.
 o getTemporaryFile
 public File getTemporaryFile()
Returns a handle to the temporary file that stores the uploaded file. This file may disappear when ExtendedRequest.deleteTemporaryFiles() or UploadedFile.deleteTemporaryFile() is called, so use with care.

Throws: IllegalStateException
when the contents have been saved in memory.
 o deleteTemporaryFile
 public void deleteTemporaryFile()
Deletes any temporary file associated with this uploaded file. When called a second time or for an uploaded file whose contents are stored in memory, nothing is done.

 o toString
 public String toString()
Returns the full client-side filename of the uploaded file.

Returns:
the full client-side filename of the uploaded file
Overrides:
toString in class Object

All Packages  Class Hierarchy  This Package  Previous  Next  Index