Class DfsInserter.StreamLoader
java.lang.Object
org.eclipse.jgit.lib.ObjectLoader
org.eclipse.jgit.internal.storage.dfs.DfsInserter.StreamLoader
- Enclosing class:
DfsInserter
-
Nested Class Summary
Nested classes/interfaces inherited from class org.eclipse.jgit.lib.ObjectLoader
ObjectLoader.Filter, ObjectLoader.SmallObject
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbyte[]
Obtain a reference to the (possibly cached) bytes of this object.long
getSize()
Get size of object in bytesint
getType()
Get Git in pack object typeboolean
isLarge()
Whether this object is too large to obtain as a byte array.Obtain an input stream to read this object's data.Methods inherited from class org.eclipse.jgit.lib.ObjectLoader
copyTo, getBytes, getBytes, getCachedBytes
-
Field Details
-
id
-
type
private final int type -
size
private final long size -
srcPack
-
pos
private final long pos
-
-
Constructor Details
-
StreamLoader
StreamLoader(ObjectId id, int type, long sz, DfsStreamKey key, long pos)
-
-
Method Details
-
openStream
Description copied from class:ObjectLoader
Obtain an input stream to read this object's data.- Specified by:
openStream
in classObjectLoader
- Returns:
- a stream of this object's data. Caller must close the stream when through with it. The returned stream is buffered with a reasonable buffer size.
- Throws:
IOException
- the object store cannot be accessed.
-
getType
public int getType()Description copied from class:ObjectLoader
Get Git in pack object type- Specified by:
getType
in classObjectLoader
- Returns:
- Git in pack object type, see
Constants
.
-
getSize
public long getSize()Description copied from class:ObjectLoader
Get size of object in bytes- Specified by:
getSize
in classObjectLoader
- Returns:
- size of object in bytes
-
isLarge
public boolean isLarge()Description copied from class:ObjectLoader
Whether this object is too large to obtain as a byte array.- Overrides:
isLarge
in classObjectLoader
- Returns:
- true if this object is too large to obtain as a byte array.
Objects over a certain threshold should be accessed only by their
ObjectLoader.openStream()
to prevent overflowing the JVM heap.
-
getCachedBytes
Description copied from class:ObjectLoader
Obtain a reference to the (possibly cached) bytes of this object.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.
- Specified by:
getCachedBytes
in classObjectLoader
- Returns:
- the cached bytes of this object. Do not modify it.
- Throws:
LargeObjectException
- if the object won't fit into a byte array, becauseObjectLoader.isLarge()
returns true. Callers should useObjectLoader.openStream()
instead to access the contents.
-