public class FileItemStreamImpl extends Object implements FileItemStream
FileItemStream
.FileItemStream.ItemSkippedException
Constructor and Description |
---|
FileItemStreamImpl(FileItemIteratorImpl pFileItemIterator,
String pName,
String pFieldName,
String pContentType,
boolean pFormField,
long pContentLength)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the file item.
|
String |
getContentType()
Returns the items content type, or null.
|
String |
getFieldName()
Returns the items field name.
|
FileItemHeaders |
getHeaders()
Returns the file item headers.
|
String |
getName()
Returns the items file name.
|
boolean |
isFormField()
Returns, whether this is a form field.
|
InputStream |
openStream()
Returns an input stream, which may be used to
read the items contents.
|
void |
setHeaders(FileItemHeaders pHeaders)
Sets the file item headers.
|
public FileItemStreamImpl(FileItemIteratorImpl pFileItemIterator, String pName, String pFieldName, String pContentType, boolean pFormField, long pContentLength) throws FileUploadException, IOException
pFileItemIterator
- The iterator
, which returned this file
item.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 -1IOException
- Creating the file item failed.FileUploadException
- Parsing the incoming data stream failed.public String getContentType()
getContentType
in interface FileItemStream
public String getFieldName()
getFieldName
in interface FileItemStream
public String getName()
getName
in interface FileItemStream
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().public boolean isFormField()
isFormField
in interface FileItemStream
public InputStream openStream() throws IOException
openStream
in interface FileItemStream
IOException
- An I/O error occurred.FileItemStream.ItemSkippedException
public void close() throws IOException
IOException
- An I/O error occurred.public FileItemHeaders getHeaders()
getHeaders
in interface FileItemHeadersSupport
public void setHeaders(FileItemHeaders pHeaders)
setHeaders
in interface FileItemHeadersSupport
pHeaders
- The items header objectCopyright © 2000-2021 Apache Software Foundation. All Rights Reserved.