Top Description Fields Constructors Methods
org.apache.tomcat.util.http.fileupload.impl

public Class FileItemStreamImpl

extends Object
implements FileItemStream
Class Inheritance
All Implemented Interfaces
org.apache.tomcat.util.http.fileupload.FileItemStream, org.apache.tomcat.util.http.fileupload.FileItemHeadersSupport
Imports
java.io.IOException, .InputStream, org.apache.tomcat.util.http.fileupload.FileItemHeaders, .FileItemStream, .FileUploadException, .InvalidFileNameException, .MultipartStream.ItemInputStream, org.apache.tomcat.util.http.fileupload.util.Closeable, .LimitedInputStream, .Streams

Default implementation of FileItemStream.

Field Summary

Modifier and TypeField and Description
private final String
contentType

The file items content type.

private final String
fieldName

The file items field name.

private final FileItemIteratorImpl
fileItemIteratorImpl

The File Item iterator implementation.

private final boolean
formField

Whether the file item is a form field.

private FileItemHeaders
headers

The headers, if any.

private final String
name

The file items file name.

private final InputStream
stream

The file items input stream.

Constructor Summary

AccessConstructor and Description
public
FileItemStreamImpl(final FileItemIteratorImpl
The iterator, which returned this file item.
pFileItemIterator
,
final String
The items file name, or null.
pName
,
final String
The items field name.
pFieldName
,
final String
The items content type, or null.
pContentType
,
final boolean
Whether the item is a form field.
pFormField
,
final long
The items content length, if known, or -1
pContentLength
)

Creates a new instance.

Method Summary

Modifier and TypeMethod and Description
public void
close()

Closes the file item.

public String

Returns:

Content type, if known, or null.
getContentType
()

Implements org.apache.tomcat.util.http.fileupload.FileItemStream.getContentType.

Returns the items content type, or null.

public String

Returns:

Field name.
getFieldName
()

Implements org.apache.tomcat.util.http.fileupload.FileItemStream.getFieldName.

Returns the items field name.

public FileItemHeaders

Returns:

The items header object
getHeaders
()

Implements org.apache.tomcat.util.http.fileupload.FileItemHeadersSupport.getHeaders.

Returns the file item headers.

public String

Returns:

File name, if known, or null.
getName
()

Implements org.apache.tomcat.util.http.fileupload.FileItemStream.getName.

Returns the items file name.

public boolean

Returns:

True, if the item is a form field, otherwise false.
isFormField
()

Implements org.apache.tomcat.util.http.fileupload.FileItemStream.isFormField.

Returns, whether this is a form field.

public InputStream

Returns:

Opened input stream.
openStream
()

Implements org.apache.tomcat.util.http.fileupload.FileItemStream.openStream.

Returns an input stream, which may be used to read the items contents.

public void
setHeaders(final FileItemHeaders
The items header object
pHeaders
)

Implements org.apache.tomcat.util.http.fileupload.FileItemHeadersSupport.setHeaders.

Sets the file item headers.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

contentTypeback to summary
private final String contentType

The file items content type.

fieldNameback to summary
private final String fieldName

The file items field name.

fileItemIteratorImplback to summary
private final FileItemIteratorImpl fileItemIteratorImpl

The File Item iterator implementation.

See Also
FileItemIteratorImpl
formFieldback to summary
private final boolean formField

Whether the file item is a form field.

headersback to summary
private FileItemHeaders headers

The headers, if any.

nameback to summary
private final String name

The file items file name.

streamback to summary
private final InputStream stream

The file items input stream.

Constructor Detail

FileItemStreamImplback to summary
public FileItemStreamImpl(final FileItemIteratorImpl pFileItemIterator, final String pName, final String pFieldName, final String pContentType, final boolean pFormField, final long pContentLength) throws FileUploadException, IOException

Creates a new instance.

Parameters
pFileItemIterator:FileItemIteratorImpl

The iterator, which returned this file item.

pName:String

The items file name, or null.

pFieldName:String

The items field name.

pContentType:String

The items content type, or null.

pFormField:boolean

Whether the item is a form field.

pContentLength:long

The items content length, if known, or -1

Exceptions
FileUploadException:
Parsing the incoming data stream failed.
IOException:
Creating the file item failed.

Method Detail

closeback to summary
public void close() throws IOException

Closes the file item.

Exceptions
IOException:
An I/O error occurred.
getContentTypeback to summary
public String getContentType()

Implements org.apache.tomcat.util.http.fileupload.FileItemStream.getContentType.

Returns the items content type, or null.

Returns:String

Content type, if known, or null.

Annotations
@Override
getFieldNameback to summary
public String getFieldName()

Implements org.apache.tomcat.util.http.fileupload.FileItemStream.getFieldName.

Returns the items field name.

Returns:String

Field name.

Annotations
@Override
getHeadersback to summary
public FileItemHeaders getHeaders()

Implements org.apache.tomcat.util.http.fileupload.FileItemHeadersSupport.getHeaders.

Returns the file item headers.

Returns:FileItemHeaders

The items header object

Annotations
@Override
getNameback to summary
public String getName()

Implements org.apache.tomcat.util.http.fileupload.FileItemStream.getName.

Returns the items file name.

Returns:String

File name, if known, or null.

Annotations
@Override
Exceptions
InvalidFileNameException:
The file name contains a NUL character, which might be an indicator of a security attack. If you intend to use the file name anyways, catch the exception and use InvalidFileNameException#getName().
isFormFieldback to summary
public boolean isFormField()

Implements org.apache.tomcat.util.http.fileupload.FileItemStream.isFormField.

Returns, whether this is a form field.

Returns:boolean

True, if the item is a form field, otherwise false.

Annotations
@Override
openStreamback to summary
public InputStream openStream() throws IOException

Implements org.apache.tomcat.util.http.fileupload.FileItemStream.openStream.

Returns an input stream, which may be used to read the items contents.

Returns:InputStream

Opened input stream.

Annotations
@Override
Exceptions
IOException:
An I/O error occurred.
setHeadersback to summary
public void setHeaders(final FileItemHeaders pHeaders)

Implements org.apache.tomcat.util.http.fileupload.FileItemHeadersSupport.setHeaders.

Sets the file item headers.

Parameters
pHeaders:FileItemHeaders

The items header object

Annotations
@Override