public interface FormUpload
| Modifier and Type | Method and Description |
|---|---|
List<String> |
getAcceptedTypes()
|
byte[] |
getBytes()
Returns the bytes of the uploaded
File. |
String |
getContentType()
Returns the content-type (if any) for this
FormUpload. |
File |
getFile()
|
long |
getMaxSize()
Returns the maximum size (in bytes) for the uploaded
File (default: -1, which means there is no limit). |
long |
getMinSize()
Returns the minimum size (in bytes) for the uploaded file (default: 0).
|
String |
getOriginalFilename()
Returns the name of the original (without any path prefix) file which was uploaded.
|
boolean |
isValid()
Returns
true if, and only if, all of those methods return true:
isValidFile()
isValidSize()
isValidType()
|
boolean |
isValid(Class<? extends FormUploadValidator> validatorClass)
Calls
FormUploadValidator.isValid(FormUpload) using this FormUpload and returns the result. |
boolean |
isValid(FormUploadValidator validator)
Calls
FormUploadValidator.isValid(FormUpload) using this FormUpload and returns the result. |
boolean |
isValid(String[] types,
long minSize,
long maxSize)
Checks whether this
FormUpload has one of the given types and matches the given size restrictions. |
boolean |
isValidFile()
|
boolean |
isValidSize()
Checks whether the
File has a valid size. |
boolean |
isValidType()
Checks whether the
File's extension or content-type are contained in the list of accepted types
for this FormUpload. |
long |
size()
Returns the size (in bytes) of the uploaded
File. |
String getOriginalFilename()
File getFile()
File which has been locally saved, but only if isValid() returns true. The
name of this file may have nothing to do with the file's original name.File, or null if no file was uploaded or isValid() returns falsegetOriginalFilename()byte[] getBytes()
File.long size()
File.long getMinSize()
long getMaxSize()
File (default: -1, which means there is no limit).boolean isValid()
true if, and only if, all of those methods return true:
true if this FormUpload is valid, false otherwise.boolean isValid(FormUploadValidator validator)
FormUploadValidator.isValid(FormUpload) using this FormUpload and returns the result.validator - a FormUploadValidatorFormUploadValidator.isValid(FormUpload)boolean isValid(Class<? extends FormUploadValidator> validatorClass)
FormUploadValidator.isValid(FormUpload) using this FormUpload and returns the result.validatorClass - a type extending FormUploadValidatorFormUploadValidator.isValid(FormUpload)boolean isValid(String[] types, long minSize, long maxSize)
FormUpload has one of the given types and matches the given size restrictions.
Delegates to isValidSize() and isValidType().types - an array containing the allowed file-extensions (without .) and content-typesminSize - the minimum size of the file (in bytes)maxSize - the maximum size of the file (in bytes)true if this FormUpload is valid, false otherwise.isValidSize(),
isValidType(),
getContentType(),
getAcceptedTypes()boolean isValidSize()
File has a valid size. Note that by default, there is no minimum size. The default
maximum size is provided by the concrete FormUpload.true if the file's size is valid, false otherwiseisValid(String[], long, long),
getMinSize(),
getMaxSize()boolean isValidType()
File's extension or content-type are contained in the list of accepted types
for this FormUpload. If getAcceptedTypes() is null or empty, all types are allowed.true if the uploaded File has a valid type, false otherwise.getAcceptedTypes(),
getContentType()List<String> getAcceptedTypes()
getContentType()boolean isValidFile()
true if the File is valid, false otherwiseString getContentType()
FormUpload. Usually the content-type has been retrieved using
ServletRequest.getContentType()FormUpload, or nullCopyright © 2011–2019 aiticon GmbH. All rights reserved.