| org.springframework.web.multipart.MultipartFile
All known Subclasses: org.springframework.web.multipart.commons.CommonsMultipartFile, org.springframework.mock.web.MockMultipartFile,
Method Summary | |
byte[] | getBytes() Return the contents of the file as an array of bytes. | String | getContentType() Return the content type of the file. | InputStream | getInputStream() Return an InputStream to read the contents of the file from. | String | getName() Return the name of the parameter in the multipart form. | String | getOriginalFilename() Return the original filename in the client's filesystem. | long | getSize() Return the size of the file in bytes. | boolean | isEmpty() Return whether the uploaded file is empty, that is, either no file has
been chosen in the multipart form or the chosen file has no content. | void | transferTo(File dest) Transfer the received file to the given destination file.
This may either move the file in the filesystem, copy the file in the
filesystem, or save memory-held contents to the destination file.
If the destination file already exists, it will be deleted first.
If the file has been moved in the filesystem, this operation cannot
be invoked again. |
getBytes | byte[] getBytes() throws IOException(Code) | | Return the contents of the file as an array of bytes.
the contents of the file as bytes, or an empty byte array if empty throws: IOException - in case of access errors (if the temporary store fails) |
getContentType | String getContentType()(Code) | | Return the content type of the file.
the content type, or null if not defined(or no file has been chosen in the multipart form) |
getInputStream | InputStream getInputStream() throws IOException(Code) | | Return an InputStream to read the contents of the file from.
The user is responsible for closing the stream.
the contents of the file as stream, or an empty stream if empty throws: IOException - in case of access errors (if the temporary store fails) |
getName | String getName()(Code) | | Return the name of the parameter in the multipart form.
the name of the parameter (never null or empty) |
getOriginalFilename | String getOriginalFilename()(Code) | | Return the original filename in the client's filesystem.
This may contain path information depending on the browser used,
but it typically will not with any other than Opera.
the original filename, or the empty String if no filehas been chosen in the multipart form |
getSize | long getSize()(Code) | | Return the size of the file in bytes.
the size of the file, or 0 if empty |
isEmpty | boolean isEmpty()(Code) | | Return whether the uploaded file is empty, that is, either no file has
been chosen in the multipart form or the chosen file has no content.
|
transferTo | void transferTo(File dest) throws IOException, IllegalStateException(Code) | | Transfer the received file to the given destination file.
This may either move the file in the filesystem, copy the file in the
filesystem, or save memory-held contents to the destination file.
If the destination file already exists, it will be deleted first.
If the file has been moved in the filesystem, this operation cannot
be invoked again. Therefore, call this method just once to be able to
work with any storage mechanism.
Parameters: dest - the destination file throws: IOException - in case of reading or writing errors throws: IllegalStateException - if the file has already been movedin the filesystem and is not available anymore for another transfer |
|
|