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.Filter, ObjectLoader.SmallObject
Constructor and Description |
---|
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()
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, getCachedBytes
public 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()
ObjectLoader
getType
in class ObjectLoader
Constants
.public long getSize()
ObjectLoader
getSize
in class ObjectLoader
public boolean isLarge()
ObjectLoader
isLarge
in class ObjectLoader
ObjectLoader.openStream()
to prevent overflowing the JVM heap.public byte[] getCachedBytes()
ObjectLoader
This 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 ObjectLoader
public ObjectStream openStream()
ObjectLoader
openStream
in class ObjectLoader
Copyright © 2019 Eclipse JGit Project. All rights reserved.