public static class ObjectLoader.SmallObject extends ObjectLoader
ObjectReader implementations can use this stream type when the object's content is small enough to be accessed as a single byte array.
ObjectLoader.SmallObject| Constructor and Description |
|---|
ObjectLoader.SmallObject(int type,
byte[] data)
Construct a small object loader.
|
| Modifier and Type | Method and Description |
|---|---|
byte[] |
getCachedBytes()
Obtain a reference to the (possibly cached) bytes of this object.
|
long |
getSize() |
int |
getType() |
boolean |
isLarge() |
ObjectStream |
openStream()
Obtain an input stream to read this object's data.
|
copyTo, getBytes, getBytes, getCachedBytespublic ObjectLoader.SmallObject(int type,
byte[] data)
type - type of the object.data - the object's data array. This array will be returned as-is
for the getCachedBytes() method.public int getType()
getType in class ObjectLoaderConstants.public long getSize()
getSize in class ObjectLoaderpublic boolean isLarge()
isLarge in class ObjectLoaderObjectLoader.openStream() to prevent overflowing the JVM heap.public byte[] getCachedBytes()
ObjectLoaderThis method offers direct access to the internal caches, potentially saving on data copies between the internal cache and higher level code. Callers who receive this reference must not modify its contents. Changes (if made) will affect the cache but not the repository itself.
getCachedBytes in class ObjectLoaderpublic ObjectStream openStream()
ObjectLoaderopenStream in class ObjectLoaderCopyright © 2014. All rights reserved.