org.melati.servlet
Class MultipartFormField

Package class diagram package MultipartFormField
java.lang.Object
  extended by org.melati.servlet.MultipartFormField

public class MultipartFormField
extends Object

Holds information parsed from a multipart/form-data file upload. Based on RFC 1867 which describes the format for uploading files in multipart/form-data. Tested on IE 5.0, HotJava 3.0, Netscape Navigator 4.x

Author:
Vasily Pozhidaev (vasilyp At paneris.org)
See Also:
rfc1867

Field Summary
static long GIGABYTE
          Number of bytes in a gigabyte.
static long KILOBYTE
          Number of bytes in a kilobyte.
static long MEGABYTE
          Number of bytes in a megabyte.
 
Constructor Summary
MultipartFormField()
          Constructor.
 
Method Summary
 String getContentDisposition()
          Get the ContentDisposition.
 String getContentType()
          Get the ContentType.
 byte[] getData()
           
 File getDataFile()
          Return the data saved as a file (or null if it is not saved).
 long getDataSize()
          Return the length of the data.
 String getDataString()
           
 String getDataString(String enc)
          Get the data using the specified encoding.
 String getDataURL()
          Return a URL to the saved data (or null if no such URL exists).
 String getFieldName()
          Get the FieldName.
 FormDataAdaptor getFormDataAdaptor()
           
 String getPrettyDataSize()
          The size of the file as a formatted string.
 String getUploadedFileName()
          Get the UploadedFileName.
 String getUploadedFilePath()
          Get the UploadedFilePath.
 void setContentDisposition(String contentDisposition)
          Set the ContentDisposition.
 void setContentType(String contentType)
          Set the ContentType.
 void setFieldName(String fieldName)
          Set the FieldName.
 void setFormDataAdaptor(FormDataAdaptor adaptor)
          Work with an uploaded file/stored value.
 void setUploadedFilePath(String filePath)
          Set the UploadedFilePath.
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

KILOBYTE

public static final long KILOBYTE
Number of bytes in a kilobyte.

See Also:
Constant Field Values

MEGABYTE

public static final long MEGABYTE
Number of bytes in a megabyte.

See Also:
Constant Field Values

GIGABYTE

public static final long GIGABYTE
Number of bytes in a gigabyte.

See Also:
Constant Field Values
Constructor Detail

MultipartFormField

public MultipartFormField()
Constructor.

Method Detail

setContentType

public void setContentType(String contentType)
Set the ContentType.

Parameters:
contentType - the Content Type to set it to

getContentType

public String getContentType()
Get the ContentType.

Returns:
the ContentType

setContentDisposition

public void setContentDisposition(String contentDisposition)
Set the ContentDisposition.

Parameters:
contentDisposition - the Content Disposition to set it to

getContentDisposition

public String getContentDisposition()
Get the ContentDisposition.

Returns:
the ContentDisposition

setFieldName

public void setFieldName(String fieldName)
Set the FieldName.

Parameters:
fieldName - the name to set fieldName to

getFieldName

public String getFieldName()
Get the FieldName.

Returns:
the FieldName

setUploadedFilePath

public void setUploadedFilePath(String filePath)
Set the UploadedFilePath.

Parameters:
filePath - the name to set filePath to

getUploadedFilePath

public String getUploadedFilePath()
Get the UploadedFilePath.

Returns:
the UploadedFilePath

getUploadedFileName

public String getUploadedFileName()
Get the UploadedFileName.

Returns:
the UploadedFileName

getFormDataAdaptor

public FormDataAdaptor getFormDataAdaptor()
Returns:
the adaptor

setFormDataAdaptor

public void setFormDataAdaptor(FormDataAdaptor adaptor)
Work with an uploaded file/stored value. We can store uploaded files or values in different ways depending on which adaptor we use.

Parameters:
adaptor - a FormDataAdaptor to set adaptor to

getData

public byte[] getData()
Returns:
the saved data as a byte array

getDataString

public String getDataString()
Returns:
the saved data as a string

getDataString

public String getDataString(String enc)
Get the data using the specified encoding.

Parameters:
enc - an encoding which may be null or empty
Returns:
the saved data as a string using the encoding supplied

getDataSize

public long getDataSize()
Return the length of the data.

Returns:
the length of the data

getDataFile

public File getDataFile()
Return the data saved as a file (or null if it is not saved).

Returns:
The data saved as a file (or null if it is not saved)

getDataURL

public String getDataURL()
Return a URL to the saved data (or null if no such URL exists).

Returns:
a URL to the saved data (or null if no such URL exists)

getPrettyDataSize

public String getPrettyDataSize()
The size of the file as a formatted string.

Returns:
the size String.

toString

public String toString()

Overrides:
toString in class Object
See Also:
Object.toString()


Copyright © 2000-2010 PanEris. All Rights Reserved.