Class DefaultSplitBlobStore
- java.lang.Object
-
- org.apache.jackrabbit.oak.spi.blob.split.DefaultSplitBlobStore
-
- All Implemented Interfaces:
AutoCloseable
,BlobStore
,SplitBlobStore
public class DefaultSplitBlobStore extends Object implements SplitBlobStore
-
-
Constructor Summary
Constructors Constructor Description DefaultSplitBlobStore(String repositoryDir, BlobStore oldBlobStore, BlobStore newBlobStore)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
String
getBlobId(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.String
getReference(String blobId)
Returns a secure reference to blob referred by blobid, ornull
if no such reference is available.boolean
isMigrated(String blobId)
int
readBlob(String blobId, long pos, byte[] buff, int off, int length)
Read a number of bytes from a blob.String
toString()
String
writeBlob(InputStream in)
Write a blob from an input stream.String
writeBlob(InputStream in, BlobOptions options)
Ignores the options provided and delegates towriteBlob(InputStream)
.
-
-
-
Method Detail
-
isMigrated
public boolean isMigrated(String blobId) throws IOException
- Specified by:
isMigrated
in interfaceSplitBlobStore
- Throws:
IOException
-
writeBlob
public String writeBlob(InputStream in) throws IOException
Description copied from interface:BlobStore
Write a blob from an input stream. This method closes the input stream.- Specified by:
writeBlob
in interfaceBlobStore
- Parameters:
in
- the input stream- Returns:
- the blob id
- Throws:
IOException
-
writeBlob
public String writeBlob(InputStream in, BlobOptions options) throws IOException
Ignores the options provided and delegates towriteBlob(InputStream)
.- Specified by:
writeBlob
in interfaceBlobStore
- Parameters:
in
- the input stream to writeoptions
- the options to use- Returns:
- Throws:
IOException
-
readBlob
public int readBlob(String blobId, long pos, byte[] buff, int off, int length) throws IOException
Description copied from interface:BlobStore
Read a number of bytes from a blob.- Specified by:
readBlob
in interfaceBlobStore
- 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
public long getBlobLength(String blobId) throws IOException
Description copied from interface:BlobStore
Get the length of the blob.- Specified by:
getBlobLength
in interfaceBlobStore
- Parameters:
blobId
- the blob id- Returns:
- the length
- Throws:
IOException
-
getInputStream
public InputStream getInputStream(String blobId) throws IOException
Description copied from interface:BlobStore
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.- Specified by:
getInputStream
in interfaceBlobStore
- Parameters:
blobId
- the blob id- Returns:
- a new stream for given blobId
- Throws:
IOException
-
getBlobId
public String getBlobId(String reference)
Description copied from interface:BlobStore
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.
-
getReference
public String getReference(String blobId)
Description copied from interface:BlobStore
Returns a secure reference to blob referred by blobid, ornull
if no such reference is available.- Specified by:
getReference
in interfaceBlobStore
- Parameters:
blobId
- blobId referring the blob for which reference is required- Returns:
- binary reference, or
null
-
close
public void close() throws Exception
- Specified by:
close
in interfaceAutoCloseable
- Throws:
Exception
-
-