类 ByteMultipartFile
- 所有已实现的接口:
org.springframework.core.io.InputStreamSource,org.springframework.web.multipart.MultipartFile
-
字段概要
字段 -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明byte[]getBytes()Return the contents of the file as an array of bytes.Return the content type of the file.Return an InputStream to read the contents of the file from.getName()Return the name of the parameter in the multipart form.Return the original filename in the client's filesystem.longgetSize()Return the size of the file in bytes.booleanisEmpty()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.voidtransferTo(@NonNull File dest) Transfer the received file to the given destination file.从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait从接口继承的方法 org.springframework.web.multipart.MultipartFile
getResource, transferTo
-
字段详细资料
-
name
-
originalFilename
-
contentType
-
bytes
private byte[] bytes
-
-
构造器详细资料
-
ByteMultipartFile
-
-
方法详细资料
-
getName
Return the name of the parameter in the multipart form.- 指定者:
getName在接口中org.springframework.web.multipart.MultipartFile- 返回:
- the name of the parameter (never
nullor empty)
-
getOriginalFilename
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.
Note: Please keep in mind this filename is supplied by the client and should not be used blindly. In addition to not using the directory portion, the file name could also contain characters such as ".." and others that can be used maliciously. It is recommended to not use this filename directly. Preferably generate a unique one and save this one somewhere for reference, if necessary.
- 指定者:
getOriginalFilename在接口中org.springframework.web.multipart.MultipartFile- 返回:
- the original filename, or the empty String if no file has been chosen
in the multipart form, or
nullif not defined or not available - 另请参阅:
-
getContentType
Return the content type of the file.- 指定者:
getContentType在接口中org.springframework.web.multipart.MultipartFile- 返回:
- the content type, or
nullif not defined (or no file has been chosen in the multipart form)
-
isEmpty
public 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.- 指定者:
isEmpty在接口中org.springframework.web.multipart.MultipartFile
-
getSize
public long getSize()Return the size of the file in bytes.- 指定者:
getSize在接口中org.springframework.web.multipart.MultipartFile- 返回:
- the size of the file, or 0 if empty
-
getBytes
Return the contents of the file as an array of bytes.- 指定者:
getBytes在接口中org.springframework.web.multipart.MultipartFile- 返回:
- the contents of the file as bytes, or an empty byte array if empty
- 抛出:
IOException- in case of access errors (if the temporary store fails)
-
getInputStream
Return an InputStream to read the contents of the file from.The user is responsible for closing the returned stream.
- 指定者:
getInputStream在接口中org.springframework.core.io.InputStreamSource- 指定者:
getInputStream在接口中org.springframework.web.multipart.MultipartFile- 返回:
- the contents of the file as stream, or an empty stream if empty
- 抛出:
IOException- in case of access errors (if the temporary store fails)
-
transferTo
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 target file has been moved in the filesystem, this operation cannot be invoked again afterwards. Therefore, call this method just once in order to work with any storage mechanism.
NOTE: Depending on the underlying provider, temporary storage may be container-dependent, including the base directory for relative destinations specified here (for example, with Servlet multipart handling). For absolute destinations, the target file may get renamed/moved from its temporary location or newly copied, even if a temporary copy already exists.
- 指定者:
transferTo在接口中org.springframework.web.multipart.MultipartFile- 参数:
dest- the destination file (typically absolute)- 抛出:
IOException- in case of reading or writing errorsIllegalStateException- if the file has already been moved in the filesystem and is not available anymore for another transfer- 另请参阅:
-