Package org.ametys.cms.data
Class Binary
- java.lang.Object
-
- org.ametys.cms.data.Resource
-
- org.ametys.cms.data.NamedResource
-
- org.ametys.cms.data.Binary
-
- All Implemented Interfaces:
File
public class Binary extends NamedResource implements File
Class representing a binary
-
-
Field Summary
Fields Modifier and Type Field Description protected static org.slf4j.Logger
__logger
The binary's loggerprotected String
_hash
the binary's hashprotected String
_path
The path of the resource in the repository-
Fields inherited from class org.ametys.cms.data.NamedResource
_filename
-
Fields inherited from class org.ametys.cms.data.Resource
_buffer, _encoding, _lastModificationDate, _mimeType, _repositoryData, _tmpFile
-
-
Constructor Summary
Constructors Constructor Description Binary()
Default constructorBinary(RepositoryData repositoryData, String hash)
Constructor to use when reading the binary from the repository
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
closeOutputStream(ByteArrayOutputStream outputStream)
Closes the givenOutputStream
String
getHash()
Retrieves the hash of the resource's dataString
getName()
Retrieves the file's nameString
getPath()
Returns the path of this resource in its hierarchy (which is a subset of the whole repository).-
Methods inherited from class org.ametys.cms.data.NamedResource
getFilename, setFilename
-
Methods inherited from class org.ametys.cms.data.Resource
getEncoding, getInputStream, getLastModificationDate, getLength, getMimeType, getOutputStream, setEncoding, setInputStream, setLastModificationDate, setMimeType
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.ametys.cms.data.File
getInputStream, getLastModificationDate, getLength, getMimeType, setLastModificationDate, setMimeType
-
-
-
-
Constructor Detail
-
Binary
public Binary()
Default constructor
-
Binary
public Binary(RepositoryData repositoryData, String hash)
Constructor to use when reading the binary from the repository- Parameters:
repositoryData
- the repository data containing the resource's datahash
- the hash of the resource's data
-
-
Method Detail
-
closeOutputStream
protected void closeOutputStream(ByteArrayOutputStream outputStream) throws IOException
Description copied from class:Resource
Closes the givenOutputStream
- Overrides:
closeOutputStream
in classResource
- Parameters:
outputStream
- theOutputStream
to close- Throws:
IOException
- if an error occurs while registering the stream
-
getHash
public String getHash()
Retrieves the hash of the resource's data- Returns:
- the hash of the resource's data
-
-