public class StandardMultipartFile extends java.lang.Object implements MultipartFile, java.io.Serializable
| Constructor and Description |
|---|
StandardMultipartFile(FileItem fileItem)
Create an instance wrapping the given FileItem.
|
| Modifier and Type | Method and Description |
|---|---|
byte[] |
getBytes()
Return the contents of the file as an array of bytes.
|
MediaType |
getContentType()
Return the content type of the file.
|
FileItem |
getFileItem()
Return the underlying
FileItem instance. |
java.lang.String |
getFilename()
Return the original filename in the client's filesystem.
|
java.lang.String |
getName()
Return the name of the parameter in the multipart form.
|
long |
getSize()
Return the size of the file in bytes.
|
java.io.InputStream |
getStream()
Return an
InputStream to read the contents of the file from. |
protected boolean |
isAvailable()
Determine whether the multipart content is still available.
|
boolean |
isEmpty()
Return whether the uploaded file is empty.
|
void |
transferTo(java.io.File dest)
Writing the received file to the given destination file.
|
public StandardMultipartFile(FileItem fileItem)
fileItem - the FileItem to wrap.public final FileItem getFileItem()
FileItem instance. There is hardly any need to access this.public java.lang.String getName()
MultipartFilegetName in interface MultipartFilepublic java.lang.String getFilename()
MultipartFilegetFilename in interface MultipartFileFileItem#getName()public MediaType getContentType()
MultipartFilegetContentType in interface MultipartFilepublic boolean isEmpty()
MultipartFileisEmpty in interface MultipartFilepublic long getSize()
MultipartFilegetSize in interface MultipartFilepublic byte[] getBytes()
MultipartFilegetBytes in interface MultipartFilepublic java.io.InputStream getStream()
throws java.io.IOException
MultipartFileInputStream to read the contents of the file from.getStream in interface MultipartFilejava.io.IOException - in case of access errors.public void transferTo(java.io.File dest)
throws java.io.IOException,
java.lang.IllegalStateException
MultipartFileIf the target file has been written to disk, this operation cannot be invoked again afterwards.
transferTo in interface MultipartFiledest - the destination file.java.io.IOExceptionjava.lang.IllegalStateExceptionprotected boolean isAvailable()