Package org.silverpeas.core.wopi
Class SimpleWopiFile
- java.lang.Object
-
- org.silverpeas.core.wopi.WopiFile
-
- org.silverpeas.core.wopi.SimpleWopiFile
-
-
Constructor Summary
Constructors Constructor Description SimpleWopiFile(File file)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canBeAccessedBy(User user)
Indicates if the given user can access this resource.OffsetDateTime
lastModificationDate()
Gets anOffsetDateTime
instance that represents the last time that the file was modified.Optional<ResourceReference>
linkedToResource()
Gets the optional resource reference the file is linked to.void
loadInto(OutputStream output)
Loads the content of the underlying Silverpeas's file into the givenOutputStream
.String
mimeType()
Gets the mime type of the file.String
name()
Gets the string name of the file, including extension, without a path.User
owner()
A string that uniquely identifies the owner of the file.String
silverpeasId()
Silverpeas's identifier identifies the file from point of view of Silverpeas's platform.long
size()
Gets the size of the file in bytes.void
updateFrom(InputStream input)
Updates the content of underlying Silverpeas's file from data provided by the givenInputStream
.-
Methods inherited from class org.silverpeas.core.wopi.WopiFile
ext, getLastEditionDate, id, lock, setLastEditionDateAtNow, toString, version
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.silverpeas.core.security.Securable
canBeDeletedBy, canBeModifiedBy
-
-
-
-
Constructor Detail
-
SimpleWopiFile
public SimpleWopiFile(File file)
-
-
Method Detail
-
linkedToResource
public Optional<ResourceReference> linkedToResource()
Description copied from class:WopiFile
Gets the optional resource reference the file is linked to.- Specified by:
linkedToResource
in classWopiFile
- Returns:
- an optional
ResourceReference
.
-
silverpeasId
public String silverpeasId()
Description copied from class:WopiFile
Silverpeas's identifier identifies the file from point of view of Silverpeas's platform.In most of case,
WopiFile.id()
will return same identifier asWopiFile.silverpeasId()
returns.But sometimes, when a temporary view exists for a file and that the temporary view is the content exposed for modifications,
WopiFile.silverpeasId()
returns the identifier of the document andWopiFile.id()
returns the identifier of the view (the one used by WOPI exchanges).- Specified by:
silverpeasId
in classWopiFile
- Returns:
- a unique identifier as string.
-
owner
public User owner()
Description copied from class:WopiFile
A string that uniquely identifies the owner of the file. In most cases, the user who uploaded or created the file should be considered the owner.
-
name
public String name()
Description copied from class:WopiFile
Gets the string name of the file, including extension, without a path. Used for display in user interface (UI), and determining the extension of the file.
-
mimeType
public String mimeType()
Description copied from class:WopiFile
Gets the mime type of the file.
-
size
public long size()
Description copied from class:WopiFile
Gets the size of the file in bytes.
-
lastModificationDate
public OffsetDateTime lastModificationDate()
Description copied from class:WopiFile
Gets anOffsetDateTime
instance that represents the last time that the file was modified.- Specified by:
lastModificationDate
in classWopiFile
- Returns:
- an
OffsetDateTime
.
-
updateFrom
public void updateFrom(InputStream input) throws IOException
Description copied from class:WopiFile
Updates the content of underlying Silverpeas's file from data provided by the givenInputStream
.- Specified by:
updateFrom
in classWopiFile
- Parameters:
input
- anInputStream
from which the data are written.- Throws:
IOException
- when it is not possible to write into the physical file.
-
loadInto
public void loadInto(OutputStream output) throws IOException
Description copied from class:WopiFile
Loads the content of the underlying Silverpeas's file into the givenOutputStream
.- Specified by:
loadInto
in classWopiFile
- Parameters:
output
- the stream into which content file MUST be loaded.- Throws:
IOException
- when it is not possible to read the physical file.
-
-