public class InMemoryBinaryService extends Object implements BinaryService
BinaryService that stores its contents in memory, for testing.| Constructor and Description |
|---|
InMemoryBinaryService() |
| Modifier and Type | Method and Description |
|---|---|
String |
generateIdentifier()
Get a new identifier.
|
CompletionStage<? extends Binary> |
get(IRI identifier)
Get a resource by the given identifier.
|
CompletionStage<Void> |
purgeContent(IRI identifier)
Purge the content from its corresponding datastore.
|
CompletionStage<Void> |
setContent(BinaryMetadata meta,
InputStream bytes)
Set the content for a binary object.
|
public CompletionStage<? extends Binary> get(IRI identifier)
RetrievalServiceget in interface RetrievalService<Binary>identifier - the resource identifierpublic CompletionStage<Void> setContent(BinaryMetadata meta, InputStream bytes)
BinaryServicesetContent in interface BinaryServicemeta - the binary metadatabytes - the contentpublic CompletionStage<Void> purgeContent(IRI identifier)
BinaryServicepurgeContent in interface BinaryServiceidentifier - the binary object identifierCompletionStage will complete exceptionally and can be handled with
CompletionStage.handle(java.util.function.BiFunction<? super T, java.lang.Throwable, ? extends U>), CompletionStage.exceptionally(java.util.function.Function<java.lang.Throwable, ? extends T>) or similar methods.public String generateIdentifier()
BinaryServicegenerateIdentifier in interface BinaryService