to.etc.domui.util.upload
Class UploadItem

java.lang.Object
  extended by to.etc.domui.util.upload.UploadItem

public final class UploadItem
extends java.lang.Object

An item that was gotten through the multipart/form data code. This can represent an uploaded file, and all of the metadata that the browser has sent while it uploaded the file. When used from a page, the actual file data will be deleted as soon as the page is destroyed, you must make a copy if you want to retain the data.

Author:
Frits Jalvingh Created on Jan 12, 2011

Method Summary
 void close()
          Called from user code to release the file attached to this item.
 java.lang.String getCharSet()
          If known, the character set for how the data is to be decoded.
 java.lang.String getContentType()
          If specified, the MIME content type the browser provided during the upload.
 java.io.File getFile()
          Return a file for this item.
 java.lang.String getName()
          The name of the input field.
 java.lang.String getRemoteFileName()
          If specified, the name that the browser provided as the "local file name", i.e.
 int getSize()
          If this is a FILE item, this contains the size, in bytes, of the uploaded file.
 java.lang.String getValue()
          If this is a parameter and not a File, this contains the parameter's value, decoded using the browser-specified character encoding.
 boolean isEmpty()
          SILLY_INTERFACE? If this holds no value it returns true.
 boolean isFile()
          T if this actually contains a file (it is not just a parameter).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

isFile

public boolean isFile()
T if this actually contains a file (it is not just a parameter).

Returns:

getCharSet

@Nullable
public java.lang.String getCharSet()
If known, the character set for how the data is to be decoded. Can be null.


getValue

public java.lang.String getValue()
If this is a parameter and not a File, this contains the parameter's value, decoded using the browser-specified character encoding.


getName

@Nonnull
public java.lang.String getName()
The name of the input field.

Returns:

getRemoteFileName

@Nullable
public java.lang.String getRemoteFileName()
If specified, the name that the browser provided as the "local file name", i.e. the name of the file on the browser's file system that was selected for upload. Will not usually contain a path.

Returns:

getContentType

@Nullable
public java.lang.String getContentType()
If specified, the MIME content type the browser provided during the upload.

Returns:

getSize

public int getSize()
If this is a FILE item, this contains the size, in bytes, of the uploaded file.

Returns:

isEmpty

public boolean isEmpty()
SILLY_INTERFACE? If this holds no value it returns true.

Returns:

getFile

public java.io.File getFile()
Return a file for this item. If the item is not yet file-based then a new file is generated for this item.

See Also:
to.etc.server.upload.UploadItem#getFile()

close

public void close()
Called from user code to release the file attached to this item.