org.apache.commons.fileupload
Class FileUploadBase.FileItemIteratorImpl.FileItemStreamImpl

java.lang.Object
  extended by org.apache.commons.fileupload.FileUploadBase.FileItemIteratorImpl.FileItemStreamImpl
All Implemented Interfaces:
FileItemHeadersSupport, FileItemStream
Enclosing class:
FileUploadBase.FileItemIteratorImpl

private class FileUploadBase.FileItemIteratorImpl.FileItemStreamImpl
extends java.lang.Object
implements FileItemStream

Default implementation of FileItemStream.


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apache.commons.fileupload.FileItemStream
FileItemStream.ItemSkippedException
 
Field Summary
private  java.lang.String contentType
          The file items content type.
private  java.lang.String fieldName
          The file items field name.
private  boolean formField
          Whether the file item is a form field.
private  FileItemHeaders headers
          The headers, if any.
private  java.lang.String name
          The file items file name.
private  boolean opened
          Whether the file item was already opened.
private  java.io.InputStream stream
          The file items input stream.
 
Constructor Summary
FileUploadBase.FileItemIteratorImpl.FileItemStreamImpl(java.lang.String pName, java.lang.String pFieldName, java.lang.String pContentType, boolean pFormField, long pContentLength)
          Creates a new instance.
 
Method Summary
(package private)  void close()
          Closes the file item.
 java.lang.String getContentType()
          Returns the items content type, or null.
 java.lang.String getFieldName()
          Returns the items field name.
 FileItemHeaders getHeaders()
          Returns the file item headers.
 java.lang.String getName()
          Returns the items file name.
 boolean isFormField()
          Returns, whether this is a form field.
 java.io.InputStream openStream()
          Returns an input stream, which may be used to read the items contents.
 void setHeaders(FileItemHeaders pHeaders)
          Sets the file item headers.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

contentType

private final java.lang.String contentType
The file items content type.


fieldName

private final java.lang.String fieldName
The file items field name.


name

private final java.lang.String name
The file items file name.


formField

private final boolean formField
Whether the file item is a form field.


stream

private final java.io.InputStream stream
The file items input stream.


opened

private boolean opened
Whether the file item was already opened.


headers

private FileItemHeaders headers
The headers, if any.

Constructor Detail

FileUploadBase.FileItemIteratorImpl.FileItemStreamImpl

FileUploadBase.FileItemIteratorImpl.FileItemStreamImpl(java.lang.String pName,
                                                       java.lang.String pFieldName,
                                                       java.lang.String pContentType,
                                                       boolean pFormField,
                                                       long pContentLength)
                                                 throws java.io.IOException
Creates a new instance.

Parameters:
pName - The items file name, or null.
pFieldName - The items field name.
pContentType - The items content type, or null.
pFormField - Whether the item is a form field.
pContentLength - The items content length, if known, or -1
Throws:
java.io.IOException - Creating the file item failed.
Method Detail

getContentType

public java.lang.String getContentType()
Returns the items content type, or null.

Specified by:
getContentType in interface FileItemStream
Returns:
Content type, if known, or null.

getFieldName

public java.lang.String getFieldName()
Returns the items field name.

Specified by:
getFieldName in interface FileItemStream
Returns:
Field name.

getName

public java.lang.String getName()
Returns the items file name.

Specified by:
getName in interface FileItemStream
Returns:
File name, if known, or null.

isFormField

public boolean isFormField()
Returns, whether this is a form field.

Specified by:
isFormField in interface FileItemStream
Returns:
True, if the item is a form field, otherwise false.

openStream

public java.io.InputStream openStream()
                               throws java.io.IOException
Returns an input stream, which may be used to read the items contents.

Specified by:
openStream in interface FileItemStream
Returns:
Opened input stream.
Throws:
java.io.IOException - An I/O error occurred.
See Also:
FileItemStream.ItemSkippedException

close

void close()
     throws java.io.IOException
Closes the file item.

Throws:
java.io.IOException - An I/O error occurred.

getHeaders

public FileItemHeaders getHeaders()
Returns the file item headers.

Specified by:
getHeaders in interface FileItemHeadersSupport
Returns:
The items header object

setHeaders

public void setHeaders(FileItemHeaders pHeaders)
Sets the file item headers.

Specified by:
setHeaders in interface FileItemHeadersSupport
Parameters:
pHeaders - The items header object