Top Description Inners Methods
org.apache.tomcat.util.http.fileupload

public Interface FileItemStream

extends FileItemHeadersSupport
Known Direct Implementers
org.apache.tomcat.util.http.fileupload.impl.FileItemStreamImpl
Imports
java.io.IOException, .InputStream

This interface provides access to a file or form item that was received within a multipart/form-data POST request. The items contents are retrieved by calling openStream().

Instances of this class are created by accessing the iterator, returned by FileUploadBase#getItemIterator(RequestContext).

Note

There is an interaction between the iterator and its associated instances of FileItemStream: By invoking java.util.Iterator#hasNext() on the iterator, you discard all data, which hasn't been read so far from the previous data.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
FileItemStream.ItemSkippedException

This exception is thrown, if an attempt is made to read data from the InputStream, which has been returned by FileItemStream#openStream(), after java.util.Iterator#hasNext() has been invoked on the iterator, which created the FileItemStream.

Method Summary

Modifier and TypeMethod and Description
public String

Returns:

The content type passed by the browser or null if not defined.
getContentType
()

Returns the content type passed by the browser or null if not defined.

public String

Returns:

The name of the form field.
getFieldName
()

Returns the name of the field in the multipart form corresponding to this file item.

public String

Returns:

The original file name in the client's file system.
getName
()

Returns the original file name in the client's file system, as provided by the browser (or other client software).

public boolean

Returns:

true if the instance represents a simple form field; false if it represents an uploaded file.
isFormField
()

Determines whether or not a FileItem instance represents a simple form field.

public InputStream

Returns:

The input stream, from which the items data may be read.
openStream
()

Creates an InputStream, which allows to read the items contents.

Inherited from org.apache.tomcat.util.http.fileupload.FileItemHeadersSupport:
getHeaderssetHeaders

Method Detail

getContentTypeback to summary
public String getContentType()

Returns the content type passed by the browser or null if not defined.

Returns:String

The content type passed by the browser or null if not defined.

getFieldNameback to summary
public String getFieldName()

Returns the name of the field in the multipart form corresponding to this file item.

Returns:String

The name of the form field.

getNameback to summary
public String getName()

Returns the original file name in the client's file system, as provided by the browser (or other client software). In most cases, this will be the base file name, without path information. However, some clients, such as the Opera browser, do include path information.

Returns:String

The original file name in the client's file system.

isFormFieldback to summary
public boolean isFormField()

Determines whether or not a FileItem instance represents a simple form field.

Returns:boolean

true if the instance represents a simple form field; false if it represents an uploaded file.

openStreamback to summary
public InputStream openStream() throws IOException

Creates an InputStream, which allows to read the items contents.

Returns:InputStream

The input stream, from which the items data may be read.

Exceptions
IOException:
An I/O error occurred.
IllegalStateException:
The method was already invoked on this item. It is not possible to recreate the data stream.
See Also
ItemSkippedException
org.apache.tomcat.util.http.fileupload back to summary

public Class FileItemStream.ItemSkippedException

extends IOException
Class Inheritance

This exception is thrown, if an attempt is made to read data from the InputStream, which has been returned by FileItemStream#openStream(), after java.util.Iterator#hasNext() has been invoked on the iterator, which created the FileItemStream.

Field Summary

Modifier and TypeField and Description
private static final long
serialVersionUID

Hides java.io.IOException.serialVersionUID.

The exceptions serial version UID, which is being used when serializing an exception instance.

Constructor Summary

AccessConstructor and Description
public

Field Detail

serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.io.IOException.serialVersionUID.

The exceptions serial version UID, which is being used when serializing an exception instance.

Constructor Detail

ItemSkippedExceptionback to summary
public ItemSkippedException()