Interface BlobStore
-
- All Superinterfaces:
AutoCloseable
- All Known Subinterfaces:
BlobStoreWrapper
,GarbageCollectableBlobStore
,SplitBlobStore
- All Known Implementing Classes:
AbstractBlobStore
,BasicReadOnlyBlobStore
,CachingBlobStore
,CloudBlobStore
,DataStoreBlobStore
,DefaultSplitBlobStore
,FileBlobStore
,MemoryBlobStore
,MongoBlobStore
,RDBBlobStore
,WrappingSplitBlobStore
public interface BlobStore extends AutoCloseable
An interface to store and read large binary objects.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description @Nullable String
getBlobId(@NotNull String reference)
Returns the blobId that referred by the given binary reference.long
getBlobLength(String blobId)
Get the length of the blob.InputStream
getInputStream(String blobId)
Returns a new stream for given blobId.@Nullable String
getReference(@NotNull String blobId)
Returns a secure reference to blob referred by blobid, ornull
if no such reference is available.int
readBlob(String blobId, long pos, byte[] buff, int off, int length)
Read a number of bytes from a blob.String
writeBlob(InputStream in)
Write a blob from an input stream.String
writeBlob(InputStream in, BlobOptions options)
Write a blob from an input stream with specified options.-
Methods inherited from interface java.lang.AutoCloseable
close
-
-
-
-
Method Detail
-
writeBlob
String writeBlob(InputStream in) throws IOException
Write a blob from an input stream. This method closes the input stream.- Parameters:
in
- the input stream- Returns:
- the blob id
- Throws:
IOException
-
writeBlob
String writeBlob(InputStream in, BlobOptions options) throws IOException
Write a blob from an input stream with specified options. This method closes the input stream.- Parameters:
in
- the input stream to writeoptions
- the options to use- Returns:
- Throws:
IOException
-
readBlob
int readBlob(String blobId, long pos, byte[] buff, int off, int length) throws IOException
Read a number of bytes from a blob.- Parameters:
blobId
- the blob idpos
- the position within the blobbuff
- the target byte arrayoff
- the offset within the target arraylength
- the number of bytes to read- Returns:
- the number of bytes read
- Throws:
IOException
-
getBlobLength
long getBlobLength(String blobId) throws IOException
Get the length of the blob.- Parameters:
blobId
- the blob id- Returns:
- the length
- Throws:
IOException
-
getInputStream
InputStream getInputStream(String blobId) throws IOException
Returns a new stream for given blobId. The streams returned from multiple calls to this method are byte wise equals. That is, subsequent calls toread
return the same sequence of bytes as long as neither call throws an exception.- Parameters:
blobId
- the blob id- Returns:
- a new stream for given blobId
- Throws:
IOException
-
getBlobId
@Nullable @Nullable String getBlobId(@NotNull @NotNull String reference)
Returns the blobId that referred by the given binary reference. Returnsnull
if the reference is invalid, for example if it points to a blob that does not exist.- Parameters:
reference
- binary reference- Returns:
- matching blobId, or
null
-
-