public class SQLBinaryManager extends BinaryCachingManager
The BLOBs are cached locally on first access for efficiency.
Because the BLOB length can be accessed independently of the binary stream, it is also cached in a simple text file if accessed before the stream.
Modifier and Type | Class and Description |
---|---|
static class |
AbstractBinaryManager.NullBinaryScrambler
A
BinaryScrambler that does nothing. |
static class |
AbstractBinaryManager.ScrambledBinary
A
Binary that is unscrambled on read using a
BinaryScrambler . |
static class |
AbstractBinaryManager.ScrambledFileInputStream
A
FileInputStream that is unscrambled on read using a
BinaryScrambler . |
static class |
AbstractBinaryManager.ScrambledStreamSource
A
FileSource that is unscrambled on read using a
BinaryScrambler . |
class |
SQLBinaryManager.SQLBinaryFileCache |
static class |
SQLBinaryManager.SQLBinaryGarbageCollector |
Modifier and Type | Field and Description |
---|---|
static String |
CACHE_SIZE_PREFIX |
static String |
COL_BIN |
static String |
COL_ID |
static String |
COL_MARK |
static String |
DEFAULT_CACHE_SIZE |
static int |
DEFAULT_DEPTH |
static String |
DEFAULT_DIGEST |
static String |
DS_PREFIX |
static int |
MAX_BUF_SIZE |
static int |
MIN_BUF_SIZE |
static String |
TABLE_PREFIX |
Constructor and Description |
---|
SQLBinaryManager() |
Modifier and Type | Method and Description |
---|---|
BinaryFileCache |
fileCache() |
Binary |
getBinary(InputStream in)
Saves the given input stream into a
Binary . |
Binary |
getBinary(String digest)
Returns a
Binary corresponding to the given digest. |
BinaryGarbageCollector |
getGarbageCollector()
Returns the Binary Garbage Collector that can be used for this binary
manager.
|
void |
initialize(RepositoryDescriptor repositoryDescriptor)
Initializer.
|
static String |
toHexString(byte[] data) |
public static final String DS_PREFIX
public static final String TABLE_PREFIX
public static final String CACHE_SIZE_PREFIX
public static final String DEFAULT_CACHE_SIZE
public static final String COL_ID
public static final String COL_BIN
public static final String COL_MARK
public static final String DEFAULT_DIGEST
public static final int DEFAULT_DEPTH
public static final int MIN_BUF_SIZE
public static final int MAX_BUF_SIZE
public void initialize(RepositoryDescriptor repositoryDescriptor) throws IOException
BinaryManager
initialize
in interface BinaryManager
IOException
public Binary getBinary(InputStream in) throws IOException
BinaryManager
Binary
.
Returns a Binary
representing the stream. The Binary
includes a digest that is a sufficient representation to persist it.
The stream is closed after use.
getBinary
in interface BinaryManager
in
- the input streamIOException
public Binary getBinary(String digest)
BinaryManager
Binary
corresponding to the given digest.
A null
is returned if the digest could not be found.
getBinary
in interface BinaryManager
getBinary
in class BinaryCachingManager
digest
- the digest, or null
public BinaryFileCache fileCache()
fileCache
in class BinaryCachingManager
public static String toHexString(byte[] data)
public BinaryGarbageCollector getGarbageCollector()
BinaryManager
Several calls to this method will return the same GC, so that its status
can be monitored using BinaryGarbageCollector.isInProgress()
.
getGarbageCollector
in interface BinaryManager
Copyright © 2013 Nuxeo SA. All Rights Reserved.