public class ContentAddressableStoreInfinispanImpl extends ContentAddressableStoreImpl
Modifier and Type | Field and Description |
---|---|
static String |
cacheNamePropertyName |
static String |
configFilePropertyName |
Constructor and Description |
---|
ContentAddressableStoreInfinispanImpl(Properties properties) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
boolean |
contains(Hash hash)
Check whether content exists in the store with the specified hash
|
boolean |
contains(Hash hash,
ContentEncoding contentEncoding)
Check whether content exists in the store with the specified hash with the specified encoding
|
boolean |
delete(Hash hash)
Delete content from the store.
|
long |
getContentLength(Hash hash)
Get the length of the content with the specified hash
|
long |
getContentLength(Hash hash,
ContentEncoding contentEncoding)
Get the length of the encoded content with the specified hash.
|
List<Hash> |
getHashes()
Get a list of all hashes in the store.
|
InputStream |
read(Hash hash)
Read content from the store.
|
InputStream |
read(Hash hash,
ContentEncoding contentEncoding)
Read content from the store, returning using the given encoding.
|
Hash |
write(InputStream inputStream)
Write content to the store, returning its hash.
|
Hash |
write(InputStream inputStream,
List<ContentEncoding> encodings)
Write content to the store in raw format and also formats specified in
the ContentEncodings.
|
addListener, notifyListenersContentAdded, notifyListenersContentRemoved, removeListener
public static final String configFilePropertyName
public static final String cacheNamePropertyName
public ContentAddressableStoreInfinispanImpl(Properties properties) throws IOException
IOException
public Hash write(InputStream inputStream) throws IOException
ContentAddressableStore
inputStream
- Content to be writtenIOException
public Hash write(InputStream inputStream, List<ContentEncoding> encodings) throws IOException
ContentAddressableStore
inputStream
- Content to be writtenIOException
public boolean contains(Hash hash)
ContentAddressableStore
hash
- Hash of content to checktrue
if content exists in the store with specified
hashpublic boolean contains(Hash hash, ContentEncoding contentEncoding)
ContentAddressableStore
hash
- Hash of content to checkcontentEncoding
- Type of encoding to use.true
if content exists in the store with specified
hash and specified encoding.public InputStream read(Hash hash) throws FileNotFoundException
ContentAddressableStore
hash
- The hash of the content to read.InputStream
of content if content exists; otherwise
null
.FileNotFoundException
public InputStream read(Hash hash, ContentEncoding contentEncoding) throws FileNotFoundException
ContentAddressableStore
hash
- The hash of the (raw) content to read.contentEncoding
- Type of encoding to use to return the stream. If null then no
encoding is used.InputStream
of content if content exists; otherwise
null
.FileNotFoundException
public long getContentLength(Hash hash) throws IOException
ContentAddressableStore
hash
- The hash of the contentIOException
public long getContentLength(Hash hash, ContentEncoding contentEncoding) throws IOException
ContentAddressableStore
hash
- The hash of the contentcontentEncoding
- The encoding type to use. If null then no encoding is used and
the raw content is assumed.IOException
public List<Hash> getHashes() throws IOException
ContentAddressableStore
IOException
public boolean delete(Hash hash) throws IOException
ContentAddressableStore
hash
- Hash of content to deletetrue
if the content existed and was deleted;
otherwise false.IOException
public void close()
Copyright © 2019. All rights reserved.