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__loggerThe binary's loggerprotected String_hashthe binary's hashprotected String_pathThe 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 voidcloseOutputStream(ByteArrayOutputStream outputStream)Closes the givenOutputStreamStringgetHash()Retrieves the hash of the resource's dataStringgetName()Retrieves the file's nameStringgetPath()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:ResourceCloses the givenOutputStream- Overrides:
closeOutputStreamin classResource- Parameters:
outputStream- theOutputStreamto 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
-
-