Interface BlobStore
- All Superinterfaces:
AutoCloseable
- All Known Subinterfaces:
BlobStoreWrapper
,GarbageCollectableBlobStore
,SplitBlobStore
- All Known Implementing Classes:
AbstractBlobStore
,CachingBlobStore
,DataStoreBlobStore
,DefaultSplitBlobStore
,FileBlobStore
,MemoryBlobStore
,WrappingSplitBlobStore
An interface to store and read large binary objects.
-
Method Summary
Modifier and TypeMethodDescription@Nullable String
Returns the blobId that referred by the given binary reference.long
getBlobLength
(String blobId) Get the length of the blob.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
Read a number of bytes from a blob.writeBlob
(InputStream in) Write a blob from an input stream.writeBlob
(InputStream in, BlobOptions options) Write a blob from an input stream with specified options.Methods inherited from interface java.lang.AutoCloseable
close
-
Method Details
-
writeBlob
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
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
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
Get the length of the blob.- Parameters:
blobId
- the blob id- Returns:
- the length
- Throws:
IOException
-
getInputStream
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
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
-
getReference
Returns a secure reference to blob referred by blobid, ornull
if no such reference is available.- Parameters:
blobId
- blobId referring the blob for which reference is required- Returns:
- binary reference, or
null
-