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
All Methods Instance Methods Concrete Methods 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.
-
-
-
Method Detail
-
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 returnfalse
.
-
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()
returnsfalse
.
-
getInputStream
public InputStream getInputStream() throws IOException
Gets the content of this file as an InputStream. This method throws an error ifisLoaded()
returnsfalse
.- Returns:
- The content of this file as an InputStream.
- Throws:
IOException
- if an error occurs.
-
-