public interface BinaryDatabase extends AutoCloseable
| Modifier and Type | Method and Description |
|---|---|
Duration |
addBinary(@NonNull UUID binaryId,
byte[] bytes)
Add a binary into the database
|
Duration |
addBinary(UUID binaryId,
InputStream stream)
Add a binary into the database
|
static BinaryDatabase |
current()
Get a reference to the current
BinaryDatabase from the Context.current() |
Duration |
extendBinaryExpiration(UUID binaryId)
Extend the expiration date of a binary
|
Binary |
getBinary(UUID binaryId)
Get a binary by its identifier
|
BinaryInfo |
getBinaryInfo(UUID binaryId)
Get the information of a binary by its identifier
|
void |
removeAllBinaries()
Remove all binaries from the database
|
void |
removeBinary(UUID binaryId)
Remove a binary from the database
|
closeBinary getBinary(UUID binaryId) throws BinaryDatabaseException
binaryId - The binary identifierBinaryDatabaseException - when the binary does not exist or cannot be retrievedBinaryInfo getBinaryInfo(UUID binaryId) throws BinaryDatabaseException
binaryId - the binary identifierBinaryDatabaseException - when the binary does not exist or cannot be retrievedDuration addBinary(@NonNull @NonNull UUID binaryId, byte[] bytes) throws BinaryDatabaseException
binaryId - The binary identifierbytes - The data to save in the databaseBinaryDatabaseException - when the binary cannot be added into databaseDuration addBinary(UUID binaryId, InputStream stream) throws BinaryDatabaseException
binaryId - The binary identifierstream - The data stream to save in the databaseBinaryDatabaseException - when the binary cannot be added into databaseDuration extendBinaryExpiration(UUID binaryId) throws BinaryDatabaseException
binaryId - The binary identifierBinaryDatabaseException - when the binary expiration cannot be extendedvoid removeAllBinaries()
throws BinaryDatabaseException
BinaryDatabaseException - when the binaries cannot be removed from the databasevoid removeBinary(UUID binaryId) throws BinaryDatabaseException
binaryId - The binary identifier to removeBinaryDatabaseException - when the binary cannot be removed from the databasestatic BinaryDatabase current()
BinaryDatabase from the Context.current()BinaryDatabaseCopyright © 2022 SiLA Java Developers. All rights reserved.