Package com.orchestranetworks.schema.types.file

# Class UploadedFile

java.lang.Object
com.orchestranetworks.schema.types.file.UploadedFile

public final class UploadedFile extends Object
This class represents an uploaded file.

Since:
  5.8.0
See Also:
  - Implementing a user service
  - `BeanDefinition.OSD_FILE_UPLOAD`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `UploadedFile()`
  Default constructor.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `clear()`
  Deletes the underlying storage for this file.
  `String`
  `getContentType()`
  Gets the content type of this file.
  `InputStream`
  `getInputStream()`
  Gets the content of this file as an InputStream.
  `String`
  `getName()`
  Returns the original file name in the client's file system, as provided by the browser.
  `long`
  `getSize()`
  Returns the size of this file.
  `boolean`
  `isLoaded()`
  Returns true if a file is loaded.

  ### Methods inherited from class java.lang.Object

  `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### UploadedFile

    public UploadedFile()
    Default constructor.

- ## Method Details

  - ### isLoaded

    public boolean isLoaded()
    Returns true if a file is loaded.
    Returns:
      `true` if and only if a file is available.

  - ### clear

    public void clear()
    Deletes the underlying storage for this file. Although this storage will eventually be deleted automatically, for example when a user service closes, this method can be used to ensure that this is done at an earlier time, thus preserving system resources.

    After calling this method, `isLoaded()` will always return `false`.

  - ### getContentType

    public String getContentType()
    Gets the content type of this file.
    Returns:
      the content type of this file or `null` if not available.

  - ### getName

    public String getName()
    Returns the original file name in the client's file system, as provided by the browser.
    Returns:
      the name of the file or `null` if not available.

  - ### getSize

    public long getSize()
    Returns the size of this file.
    Returns:
      the size, in bytes, of the file or 0 if `isLoaded()` returns `false`.

  - ### getInputStream

    public InputStream getInputStream() throws IOException
    Gets the content of this file as an InputStream. This method throws an error if `isLoaded()` returns `false`.
    Returns:
      The content of this file as an InputStream.
    Throws:
      `IOException` - if an error occurs.