public interface File extends MediaElement
A File
can be retrieved from a type Media
object by calling the
getFile()
-method if it is not a picture.
A language must be provided within the method call.
Media
Modifier and Type | Method and Description |
---|---|
long |
getCrc()
Get the crc of the file or -1 if crc isn't set
|
String |
getDescription()
Get the description of the current media.
|
String |
getEncoding()
Get the encoding of the current file-media
|
String |
getExtension()
Get the extension.
|
Revision |
getFileRevision()
Return file content revision or
null if no content exits. |
InputStream |
getInputStream()
Returns the file content as an
InputStream . |
Language |
getLanguage()
Get the language of the current
File . |
MimeType |
getMimeType()
Get the mime-type.
|
TemplateDocument |
getParsedFile()
Returns the parsed file content, if
, else
null . |
byte[] |
getPreviewImage()
Get a small preview/thumbnail image of this picture
|
long |
getSize()
Get the size of the file or -1 if size isn't set
|
void |
setDescription(String description)
Set the description of the current media.
|
void |
setEncoding(String encoding)
Set the encoding of the current file-media
|
void |
setExtension(String extension)
Set the Extension
The extension is also set by the upload methods.
|
void |
setFile(long length,
InputStream file,
String extension)
Set new data for the file including its extension and content length.
|
void |
setPreviewImage(byte[] bytes)
Set a the image data source to create a preview-thumbnail from.
|
appendChild, appendChildBefore, delete, exportStoreElement, getChildCount, getChildIndex, getChildren, getChildren, getChildren, getChildren, getCreateWorkflowPermission, getDefinedPrincipalPermissions, getEditor, getElementType, getFirstChild, getIncomingReferences, getInheritedPrincipalPermissions, getLastChanged, getName, getNextSibling, getOutgoingReferences, getParent, getPermission, getPermission, getPermission, getPreviousSibling, getProject, getReferenceName, getReferences, getStore, getTreePermission, getWorkflowPermission, getWorkflowPermissions, getWriteLock, hasIncomingReferences, hasPermissions, importStoreElement, importStoreElements, inheritWorkflowPermission, isDeleted, isExportSupported, isFolder, isImportSupported, isLocked, isLockedOnServer, isLockSupported, isPermissionSupported, isWorkflowAllowed, isWorkflowSupported, refresh, removeAllWorkflowPermissions, removeChild, removePermission, removePermission, removePermission, removeWorkflowPermission, replaceChild, save, save, save, setInheritWorkflowPermission, setLock, setLock, setPermission, setPermission, setPermission, setWorkflowPermission, setWorkflowPermissions, setWriteLock, toXml, toXml, toXml
getColor, getTask, hasTask, removeTask, setColor, setTask
compareTo
Language getLanguage()
File
.InputStream getInputStream() throws IOException
InputStream
.IOException
void setFile(long length, InputStream file, String extension) throws IOException
Calling this method will also upload the content to the FirstSpirit server.
Be aware that the uploaded data must be stored by using the save()
-method.
length
- content length in bytesfile
- as an InputStream
extension
- the file extensionIOException
Media.save()
@Nullable byte[] getPreviewImage() throws IOException
IOException
- if any error occurs while obtaining the preview image streamvoid setPreviewImage(@Nullable byte[] bytes)
bytes
- the image data or null
to reset the preview imageString getEncoding()
void setEncoding(String encoding)
encoding
- new encoding of the file-media e.g. "ISO-8859-1"String getDescription()
void setDescription(String description)
description
- new description of the mediaString getExtension()
@Nullable MimeType getMimeType()
void setExtension(String extension)
extension
- the extension@Nullable Revision getFileRevision()
null
if no content exits.long getSize()
long getCrc()
-1
for unkonwnTemplateDocument getParsedFile() throws ParsingError, IOException
Media.getParseFile()
== true
, else
null
.null
ParsingError
IOException
Copyright © 2021 e-Spirit AG. All Rights Reserved. Build 5.2.210210