org.apache.myfaces.trinidadinternal.share.util
Interface MultipartFormItem


public interface MultipartFormItem

MultipartFormItem - Represent an item from a form file-post. An item can be either a parameter or a file. If it is a parameter, use getName() and getValue() to get the name and value of the parameter. If it is a file, then use getFilename and writeFile to find the filename and then write the contents to an OutputStream.

Version:
$Name: $ ($Revision: adfrt/faces/adf-faces-impl/src/main/java/oracle/adfinternal/view/faces/share/util/MultipartFormItem.java#0 $) $Date: 10-nov-2005.18:59:24 $
Author:
The Oracle ADF Faces Team

Method Summary
 java.lang.String getContentType()
          Returns the MIME content type of the file.
 java.lang.String getFilename()
          Returns the filename of this item, or null if this is a parameter and not a file
 java.io.InputStream getInputStream()
          Returns an InputStream that can be used to read the file.
 java.lang.String getName()
          Returns the input-field name of this item in the form.
 java.lang.String getValue()
          Returns the value of the parameter, or null if this is a file and not a parameter.
 long writeFile(java.io.OutputStream stream)
          Writes the file to the given output stream.
 

Method Detail

getValue

java.lang.String getValue()
Returns the value of the parameter, or null if this is a file and not a parameter.


getName

java.lang.String getName()
Returns the input-field name of this item in the form.


getFilename

java.lang.String getFilename()
Returns the filename of this item, or null if this is a parameter and not a file


getContentType

java.lang.String getContentType()
Returns the MIME content type of the file.


writeFile

long writeFile(java.io.OutputStream stream)
               throws java.io.IOException
Writes the file to the given output stream. Clients can call this method or getInputStream(), but not both.

Parameters:
stream - the output stream to write to.
Returns:
The total number of bytes written
Throws:
java.io.EOFException - if the length of this item exceeds the maximum length set on the MultipartFormHandler
java.io.IOException
See Also:
getInputStream(), MultipartFormHandler.setMaximumAllowedBytes(long)

getInputStream

java.io.InputStream getInputStream()
                                   throws java.io.IOException
Returns an InputStream that can be used to read the file. Clients may call this method or writeFile(), but not both.

Throws:
java.io.IOException
See Also:
writeFile(java.io.OutputStream)


Copyright © 2001-2007 Apache Software Foundation. All Rights Reserved.