Interface UploadedFile

All Superinterfaces:
Serializable
All Known Implementing Classes:
StrutsInMemoryUploadedFile, StrutsUploadedFile

public interface UploadedFile extends Serializable
Virtual representation of an uploaded file used by MultiPartRequest
  • Method Details

    • length

      Long length()
      Returns:
      size of the content of file/stream/array
    • getName

      String getName()
      Returns:
      a local name of the file
    • getOriginalName

      String getOriginalName()
      Returns:
      original file name from upload source
    • isFile

      boolean isFile()
      Returns:
      indicates if this is a real file or maybe just in-memory stream
    • delete

      boolean delete()
      Returns:
      removes a local copy of the uploaded file/stream
    • getAbsolutePath

      String getAbsolutePath()
      Returns:
      an absolute path of the file if possible
    • getContent

      Object getContent()
      Returns:
      content of the upload file
    • getContentType

      String getContentType()
      Returns:
      content type of the uploaded file
    • getInputName

      String getInputName()
      Represents a name of the input file, eg.: "myFile" in case of
      Returns:
      name of the input file field
      Since:
      6.7.0
    • getInputStream

      default InputStream getInputStream() throws IOException
      Streams the uploaded content without forcing it to disk. Implementations backed by in-memory bytes can return the bytes directly; file-backed implementations stream the file. The default reads whatever getContent() exposes.
      Returns:
      an input stream over the uploaded content
      Throws:
      IOException - if the content cannot be read
      Since:
      7.3.0
    • isMissing

      default boolean isMissing()
      Indicates whether this upload has no content available (for example, the upload failed). Implementations that hold their content in memory should override this to answer WITHOUT materializing the content to disk. The default reports missing when getContent() is null.
      Returns:
      true if there is no content backing this upload
      Since:
      7.3.0