public class C4BlobStore extends C4NativePeer
Modifier and Type | Method and Description |
---|---|
C4BlobKey |
create(byte[] contents)
Stores a blob.
|
void |
delete()
Deletes the BlobStore's blobs and directory, and (if successful) frees the object.
|
void |
delete(C4BlobKey blobKey)
Deletes a blob from the store given its key.
|
void |
free()
Closes/frees a BlobStore.
|
FLSliceResult |
getContents(C4BlobKey blobKey)
Reads the entire contents of a blob into memory.
|
String |
getFilePath(C4BlobKey blobKey)
Returns the path of the file that stores the blob, if possible.
|
long |
getSize(C4BlobKey blobKey)
Gets the content size of a blob given its key.
|
static C4BlobStore |
open(String dirPath,
long flags)
Opens a BlobStore in a directory.
|
C4BlobReadStream |
openReadStream(C4BlobKey blobKey)
Opens a blob for reading, as a random-access byte stream.
|
C4BlobWriteStream |
openWriteStream()
Opens a write stream for creating a new blob.
|
accumulateAndGet, addAndGet, compareAndSet, decrementAndGet, doubleValue, floatValue, get, getAndAccumulate, getAndAdd, getAndDecrement, getAndIncrement, getAndSet, getAndUpdate, incrementAndGet, intValue, lazySet, longValue, set, toString, updateAndGet, weakCompareAndSet
byteValue, shortValue
@NonNull public static C4BlobStore open(@NonNull String dirPath, long flags) throws LiteCoreException
dirPath
- The filesystem path of the directory holding the attachments.flags
- Specifies options like create, read-onlyLiteCoreException
- for any errorpublic void delete() throws LiteCoreException
LiteCoreException
public void free()
public long getSize(C4BlobKey blobKey)
@NonNull public FLSliceResult getContents(@NonNull C4BlobKey blobKey) throws LiteCoreException
LiteCoreException
@Nullable public String getFilePath(@NonNull C4BlobKey blobKey) throws LiteCoreException
LiteCoreException
@NonNull public C4BlobKey create(@NonNull byte[] contents) throws LiteCoreException
LiteCoreException
public void delete(C4BlobKey blobKey) throws LiteCoreException
LiteCoreException
@NonNull public C4BlobReadStream openReadStream(@NonNull C4BlobKey blobKey) throws LiteCoreException
LiteCoreException
@NonNull public C4BlobWriteStream openWriteStream() throws LiteCoreException
LiteCoreException