public class FileItemIteratorImpl extends Object implements FileItemIterator
FileUploadBase.getItemIterator(RequestContext)
.Constructor and Description |
---|
FileItemIteratorImpl(FileUploadBase fileUploadBase,
RequestContext requestContext)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
List<FileItem> |
getFileItems() |
long |
getFileSizeMax()
Returns the maximum size of a single file.
|
MultipartStream |
getMultiPartStream() |
long |
getSizeMax()
Returns the maximum size of the complete HTTP request.
|
boolean |
hasNext()
Returns, whether another instance of
FileItemStream
is available. |
protected void |
init(FileUploadBase fileUploadBase,
RequestContext pRequestContext) |
FileItemStream |
next()
Returns the next available
FileItemStream . |
void |
setFileSizeMax(long fileSizeMax)
Sets the maximum size of a single file.
|
void |
setSizeMax(long sizeMax)
Returns the maximum size of the complete HTTP request.
|
public FileItemIteratorImpl(FileUploadBase fileUploadBase, RequestContext requestContext) throws FileUploadException, IOException
fileUploadBase
- Main processor.requestContext
- The request context.FileUploadException
- An error occurred while
parsing the request.IOException
- An I/O error occurred.public long getSizeMax()
FileItemIterator
SizeLimitExceededException
will be thrown, if the HTTP request will exceed this value.
By default, this value will be copied from the FileUploadBase
object, however, the user may replace the default value with a
request specific value by invoking FileItemIterator.setSizeMax(long)
on this object.getSizeMax
in interface FileItemIterator
public void setSizeMax(long sizeMax)
FileItemIterator
SizeLimitExceededException
will be thrown, if the HTTP request will exceed this value.
By default, this value will be copied from the FileUploadBase
object, however, the user may replace the default value with a
request specific value by invoking FileItemIterator.setSizeMax(long)
on this object.
Note: Setting the maximum size on this object will work only, if the iterator is not
yet initialized. In other words: If the methods FileItemIterator.hasNext()
, FileItemIterator.next()
have not
yet been invoked.setSizeMax
in interface FileItemIterator
sizeMax
- The maximum size of the complete HTTP request. The value -1 indicates "unlimited".public long getFileSizeMax()
FileItemIterator
FileSizeLimitExceededException
will be thrown, if there is an uploaded file, which is exceeding this value.
By default, this value will be copied from the FileUploadBase
object, however, the user may replace the default value with a
request specific value by invoking FileItemIterator.setFileSizeMax(long)
on this object.getFileSizeMax
in interface FileItemIterator
public void setFileSizeMax(long fileSizeMax)
FileItemIterator
FileSizeLimitExceededException
will be thrown, if there is an uploaded file, which is exceeding this value.
By default, this value will be copied from the FileUploadBase
object, however, the user may replace the default value with a
request specific value by invoking FileItemIterator.setFileSizeMax(long)
on this object, so
there is no need to configure it here.
Note:Changing this value doesn't affect files, that have already been uploaded.setFileSizeMax
in interface FileItemIterator
fileSizeMax
- The maximum size of a single, uploaded file. The value -1 indicates "unlimited".protected void init(FileUploadBase fileUploadBase, RequestContext pRequestContext) throws FileUploadException, IOException
FileUploadException
IOException
public MultipartStream getMultiPartStream() throws FileUploadException, IOException
FileUploadException
IOException
public boolean hasNext() throws FileUploadException, IOException
FileItemStream
is available.hasNext
in interface FileItemIterator
FileUploadException
- Parsing or processing the
file item failed.IOException
- Reading the file item failed.public FileItemStream next() throws FileUploadException, IOException
FileItemStream
.next
in interface FileItemIterator
NoSuchElementException
- No more items are
available. Use hasNext()
to prevent this exception.FileUploadException
- Parsing or processing the
file item failed.IOException
- Reading the file item failed.public List<FileItem> getFileItems() throws FileUploadException, IOException
getFileItems
in interface FileItemIterator
FileUploadException
IOException
Copyright © 2000-2021 Apache Software Foundation. All Rights Reserved.