类 ByteMultipartFile

java.lang.Object
com.sie.mbm.mom.framework.common.util.ByteMultipartFile
所有已实现的接口:
org.springframework.core.io.InputStreamSource, org.springframework.web.multipart.MultipartFile

class ByteMultipartFile extends Object implements org.springframework.web.multipart.MultipartFile
磁盘文件, 通过FileUtils调用
  • 字段详细资料

    • name

      private String name
    • originalFilename

      private String originalFilename
    • contentType

      private String contentType
    • bytes

      private byte[] bytes
  • 构造器详细资料

    • ByteMultipartFile

      public ByteMultipartFile(String name, String originalFilename, String contentType, byte[] bytes)
  • 方法详细资料

    • getName

      public String getName()
      Return the name of the parameter in the multipart form.
      指定者:
      getName 在接口中 org.springframework.web.multipart.MultipartFile
      返回:
      the name of the parameter (never null or empty)
    • getOriginalFilename

      public String 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 null if not defined or not available
      另请参阅:
    • getContentType

      public String getContentType()
      Return the content type of the file.
      指定者:
      getContentType 在接口中 org.springframework.web.multipart.MultipartFile
      返回:
      the content type, or null if 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

      public byte[] getBytes() throws IOException
      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

      public InputStream getInputStream() throws IOException
      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

      public void transferTo(@NonNull @NonNull File dest) throws IOException, IllegalStateException
      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 errors
      IllegalStateException - if the file has already been moved in the filesystem and is not available anymore for another transfer
      另请参阅:
      • Part.write(String)