Class MultipartRequest.File

  • All Implemented Interfaces:
    PostedFile
    Enclosing class:
    MultipartRequest

    public static class MultipartRequest.File
    extends java.lang.Object
    implements PostedFile
    The class MultipartRequest.File encapsulates uploaded files. Objects of this class are the values of file parameters. This implementation saves the data as temporary files in the directory specified by the system property java.io.tmpdir.
    Since:
    MicroStrategy Web 7.3.1 or earlier
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.io.InputStream getInputStream()
      Gets an input stream to read the contents of this object.
      long getLength()
      Gets the length of this file.
      java.lang.String getName()
      Gets the original file name, as sent by the request.
      java.lang.String getType()
      Gets the MIME type of the file, as sent by the client.
      void release()
      Releases any resources held by this MultipartRequest.File.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getInputStream

        public java.io.InputStream getInputStream()
                                           throws java.io.IOException
        Gets an input stream to read the contents of this object. The input stream returned by a previous call to getInputStream(), if any, is automatically closed.
        Specified by:
        getInputStream in interface PostedFile
        Returns:
        an input stream to read this object's contents
        Throws:
        java.io.IOException - if an error occurs while opening the input stream
      • getLength

        public long getLength()
        Gets the length of this file.
        Specified by:
        getLength in interface PostedFile
        Returns:
        the length of this file
      • getName

        public java.lang.String getName()
        Gets the original file name, as sent by the request. Notice that the file name depends on the client's platform.
        Specified by:
        getName in interface PostedFile
        Returns:
        the original file name
      • getType

        public java.lang.String getType()
        Gets the MIME type of the file, as sent by the client. Notice that, since MIME types are case insensitive, the type is always returned in lowercase.
        Specified by:
        getType in interface PostedFile
        Returns:
        the MIME type of the file or an empty string if the type is not known
      • release

        public void release()
                     throws java.io.IOException
        Releases any resources held by this MultipartRequest.File. After calling release this object is not valid anymore.
        Specified by:
        release in interface PostedFile
        Throws:
        java.io.IOException - if an error occurs while closing any opened streams or deleting the temporary file