ccc.plugins.multipart.apache
Class MultipartForm

java.lang.Object
  extended by ccc.plugins.multipart.apache.MultipartForm
All Implemented Interfaces:
MultipartFormData

public class MultipartForm
extends java.lang.Object
implements MultipartFormData

A multi-part form implemented via Apache commons file-upload.

Author:
Civic Computing Ltd.

Constructor Summary
MultipartForm(java.util.List<org.apache.commons.fileupload.FileItem> items)
          Constructor.
MultipartForm(java.lang.String charEncoding, int contentLength, java.lang.String contentType, java.io.InputStream inputStream)
          Constructor.
 
Method Summary
 java.lang.String getContentType(java.lang.String string)
          Get the content type for a form item.
 java.util.List<java.lang.String> getFormItemNames()
          Retrieve form item keys.
 java.io.InputStream getInputStream(java.lang.String string)
          Retrieve an input stream for a form item.
 long getSize(java.lang.String string)
          Get the size in bytes of a form item.
 java.lang.String getString(java.lang.String string)
          Get the string representation of a form item.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MultipartForm

public MultipartForm(java.util.List<org.apache.commons.fileupload.FileItem> items)
Constructor.

Parameters:
items - The list of items on this form.

MultipartForm

public MultipartForm(java.lang.String charEncoding,
                     int contentLength,
                     java.lang.String contentType,
                     java.io.InputStream inputStream)
Constructor.

Parameters:
charEncoding - The character encoding of the input stream.
contentLength - The number of bytes on the input stream.
contentType - The input stream's media type.
inputStream - The stream to parse as multipart.
Method Detail

getFormItemNames

public java.util.List<java.lang.String> getFormItemNames()
Retrieve form item keys.

Returns:
List of names.

getInputStream

public java.io.InputStream getInputStream(java.lang.String string)
                                   throws java.io.IOException
Retrieve an input stream for a form item.

Specified by:
getInputStream in interface MultipartFormData
Parameters:
string - The key to the item.
Returns:
An input stream to read the item.
Throws:
java.io.IOException - If a stream cannot be opened.

getContentType

public java.lang.String getContentType(java.lang.String string)
Get the content type for a form item.

Specified by:
getContentType in interface MultipartFormData
Parameters:
string - The key to the item.
Returns:
The content type as a string.

getSize

public long getSize(java.lang.String string)
Get the size in bytes of a form item.

Specified by:
getSize in interface MultipartFormData
Parameters:
string - The key to the item.
Returns:
The size, as a long.

getString

public java.lang.String getString(java.lang.String string)
Get the string representation of a form item.

Specified by:
getString in interface MultipartFormData
Parameters:
string - The key to the item.
Returns:
The item value, as a string.


Copyright © 2010. All Rights Reserved.