private static final class UnpackedObject.LargeObject extends ObjectLoader
ObjectLoader.Filter, ObjectLoader.SmallObject| Modifier and Type | Field and Description |
|---|---|
private ObjectId |
id |
private java.io.File |
path |
private long |
size |
private FileObjectDatabase |
source |
private int |
type |
| Constructor and Description |
|---|
LargeObject(int type,
long size,
java.io.File path,
AnyObjectId id,
FileObjectDatabase db) |
| Modifier and Type | Method and Description |
|---|---|
byte[] |
getCachedBytes()
Obtain a reference to the (possibly cached) bytes of this object.
|
long |
getSize()
Get size of object in bytes
|
int |
getType()
Get Git in pack object type
|
boolean |
isLarge()
Whether this object is too large to obtain as a byte array.
|
ObjectStream |
openStream()
Obtain an input stream to read this object's data.
|
copyTo, getBytes, getBytes, getCachedBytesprivate final int type
private final long size
private final java.io.File path
private final ObjectId id
private final FileObjectDatabase source
LargeObject(int type,
long size,
java.io.File path,
AnyObjectId id,
FileObjectDatabase db)
public int getType()
ObjectLoadergetType in class ObjectLoaderConstants.public long getSize()
ObjectLoadergetSize in class ObjectLoaderpublic boolean isLarge()
ObjectLoaderisLarge in class ObjectLoaderObjectLoader.openStream() to prevent overflowing the JVM heap.public byte[] getCachedBytes()
throws LargeObjectException
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 ObjectLoaderLargeObjectException - if the object won't fit into a byte array, because
ObjectLoader.isLarge() returns true. Callers should use
ObjectLoader.openStream() instead to access the contents.public ObjectStream openStream() throws MissingObjectException, java.io.IOException
ObjectLoaderopenStream in class ObjectLoaderMissingObjectException - the object no longer exists.java.io.IOException - the object store cannot be accessed.