AutoCloseable, ContentAddressableStorepublic final class ContentAddressableStoreFileImpl extends ContentAddressableStoreImpl
| Modifier and Type | Field | Description |
|---|---|---|
int |
hashPrefixLength |
The number of characters from the hash to use for the name of the top level
subdirectories.
|
static String |
rootPathPropertyName |
| Constructor | Description |
|---|---|
ContentAddressableStoreFileImpl(Properties properties) |
Initialises the store.
|
| Modifier and Type | Method | 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.
|
Path |
getContentPath(String hashString) |
|
List<Hash> |
getHashes() |
Get a list of all hashes in the store.
|
Path |
getRootPath() |
|
Path |
getSubPath(String hashString) |
|
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, removeListenerpublic final int hashPrefixLength
public static final String rootPathPropertyName
public ContentAddressableStoreFileImpl(Properties properties) throws IOException
properties - Properties controlling construction. Currently supported
properties are:
ContentAddressableStoreFileImpl.class.getName() + ".rootPath"
which specifies the path to the root directory of the
storage.IOExceptionpublic Path getRootPath()
public Hash write(InputStream inputStream) throws IOException
ContentAddressableStoreinputStream - Content to be writtenIOExceptionpublic Hash write(InputStream inputStream, List<ContentEncoding> encodings) throws IOException
ContentAddressableStoreinputStream - Content to be writtenIOExceptionpublic boolean contains(Hash hash)
ContentAddressableStorehash - Hash of content to checktrue if content exists in the store with specified
hashpublic boolean contains(Hash hash, ContentEncoding contentEncoding)
ContentAddressableStorehash - 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, ContentEncoding contentEncoding) throws IOException
ContentAddressableStorehash - 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.IOExceptionpublic InputStream read(Hash hash) throws IOException
ContentAddressableStorehash - The hash of the content to read.InputStream of content if content exists; otherwise
null.IOExceptionpublic long getContentLength(Hash hash) throws IOException
ContentAddressableStorehash - The hash of the contentIOExceptionpublic long getContentLength(Hash hash, ContentEncoding contentEncoding) throws IOException
ContentAddressableStorehash - The hash of the contentcontentEncoding - The encoding type to use. If null then no encoding is used and
the raw content is assumed.IOExceptionpublic List<Hash> getHashes() throws IOException
ContentAddressableStoreIOExceptionpublic boolean delete(Hash hash) throws IOException
ContentAddressableStorehash - Hash of content to deletetrue if the content existed and was deleted;
otherwise false.IOExceptionpublic void close()
Copyright © 2018. All rights reserved.