public class AdaptiveFileUpload extends FileUpload
FileUpload
implementation that defer the action of what to do with uploaded file
for later. Internally, it stores uploaded file either in memory if it is small, or, in all
other cases, it stores them in TEMP folder.Modifier and Type | Field and Description |
---|---|
protected boolean |
allowFileExtensions |
protected boolean |
breakOnError |
protected byte[] |
data |
protected java.lang.String[] |
fileExtensions |
protected int |
memoryThreshold |
protected java.io.File |
tempFile |
protected static java.lang.String |
TMP_FILE_SUFFIX |
protected java.io.File |
uploadPath |
fileTooBig, header, input, maxFileSize, size, valid
Modifier and Type | Method and Description |
---|---|
protected boolean |
checkUpload()
Determines if upload is allowed.
|
void |
delete()
Deletes file uploaded item from disk or memory.
|
byte[] |
getFileContent()
Returns the content of file upload item.
|
java.lang.String[] |
getFileExtensions() |
java.io.InputStream |
getFileInputStream()
Returns input stream of uploaded file.
|
int |
getMemoryThreshold() |
java.io.File |
getUploadPath() |
boolean |
isAllowFileExtensions() |
boolean |
isBreakOnError() |
boolean |
isInMemory()
Returns
true if file upload resides in memory. |
protected boolean |
matchFileExtension() |
protected void |
processStream()
Process request input stream.
|
java.io.File |
write(java.io.File destination)
Writes file upload item to destination folder or to destination file.
|
java.io.File |
write(java.lang.String destination)
Writes file uploaded item.
|
getHeader, getMaxFileSize, getSize, isFileTooBig, isUploaded, isValid, toString
protected static final java.lang.String TMP_FILE_SUFFIX
protected final int memoryThreshold
protected final java.io.File uploadPath
protected final boolean breakOnError
protected final java.lang.String[] fileExtensions
protected final boolean allowFileExtensions
protected java.io.File tempFile
protected byte[] data
public int getMemoryThreshold()
public java.io.File getUploadPath()
public boolean isBreakOnError()
public java.lang.String[] getFileExtensions()
public boolean isAllowFileExtensions()
public boolean isInMemory()
true
if file upload resides in memory.isInMemory
in class FileUpload
protected boolean matchFileExtension() throws java.io.IOException
java.io.IOException
protected boolean checkUpload() throws java.io.IOException
java.io.IOException
protected void processStream() throws java.io.IOException
FileUpload
size
attribute after successful processing. This method also must set the
valid
attribute.processStream
in class FileUpload
java.io.IOException
MultipartRequestInputStream
public void delete()
public java.io.File write(java.lang.String destination) throws java.io.IOException
java.io.IOException
public java.io.File write(java.io.File destination) throws java.io.IOException
java.io.IOException
public byte[] getFileContent() throws java.io.IOException
getFileContent
in class FileUpload
java.io.IOException
public java.io.InputStream getFileInputStream() throws java.io.IOException
FileUpload
getFileInputStream
in class FileUpload
java.io.IOException
Copyright © 2003-present Jodd Team