Top Description Inners Fields Constructors Methods
org.eclipse.jgit.internal.storage.dfs

public Class DfsInserter

extends ObjectInserter
Class Inheritance
Static Imports
org.eclipse.jgit.internal.storage.pack.PackExt.INDEX, .PackExt.OBJECT_SIZE_INDEX, .PackExt.PACK, org.eclipse.jgit.lib.Constants.OBJ_OFS_DELTA, .Constants.OBJ_REF_DELTA

Inserts objects into the DFS.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class
private class
private class
private class

Field Summary

Modifier and TypeField and Description
pack-priv DfsBlockCache
private boolean
pack-priv int
pack-priv final DfsObjDatabase
private static final int
INDEX_VERSION

Always produce version 2 indexes, to get CRC data.

private final int
pack-priv List<PackedObjectInfo>
pack-priv ObjectIdOwnerMap<PackedObjectInfo>
pack-priv DfsPackDescription
pack-priv DfsStreamKey
pack-priv DfsInserter.PackStream
private boolean

Constructor Summary

AccessConstructor and Description
protected
DfsInserter(DfsObjDatabase
database the inserter writes to.
db
)

Initialize a new inserter.

Method Summary

Modifier and TypeMethod and Description
private long
beginObject(int type, long len)

private void
public void
checkExisting(boolean
if false, will write out possibly-duplicate objects without first checking whether they exist in the repo; default is true.
check
)

Check existence

private void
public void
close()

Implements abstract org.eclipse.jgit.lib.ObjectInserter.close.

Implements java.lang.AutoCloseable.close.

Closes this resource, relinquishing any underlying resources.

private ObjectId
endObject(ObjectId id, long offset, long inflatedSize, int type)

public void
flush()

Implements abstract org.eclipse.jgit.lib.ObjectInserter.flush.

Make all inserted objects visible.

private static void
index(OutputStream out, byte[] packHash, List<PackedObjectInfo> list)

public ObjectId
insert(int
type code of the object to store.
type
,
byte[]
complete content of the object.
data
,
int
first position within data.
off
,
int
number of bytes to copy from data.
len
)

Overrides org.eclipse.jgit.lib.ObjectInserter.insert.

Insert a single object into the store, returning its unique name.

public ObjectId
insert(int
type code of the object to store.
type
,
long
number of bytes to copy from in.
len
,
InputStream
stream providing the object content. The caller is responsible for closing the stream.
in
)

Implements abstract org.eclipse.jgit.lib.ObjectInserter.insert.

Insert a single object into the store, returning its unique name.

private byte[]
insertBuffer(long len)

private TemporaryBuffer.Heap
public DfsPackParser
newPackParser(InputStream
the input stream. The stream is not closed by the parser, and must instead be closed by the caller once parsing is complete.
in
)

Implements abstract org.eclipse.jgit.lib.ObjectInserter.newPackParser.

Initialize a parser to read from a pack formatted stream.

public ObjectReader
newReader()

Implements abstract org.eclipse.jgit.lib.ObjectInserter.newReader.

Open a reader for objects that may have been written by this inserter.

pack-priv void
setCompressionLevel(int compression)

private void
pack-priv void
pack-priv PackIndex
Inherited from org.eclipse.jgit.lib.ObjectInserter:
bufferdigestidForidForidForidForinsertinsertinsertinsert

Field Detail

cacheback to summary
pack-priv DfsBlockCache cache
checkExistingback to summary
private boolean checkExisting
compressionback to summary
pack-priv int compression
dbback to summary
pack-priv final DfsObjDatabase db
INDEX_VERSIONback to summary
private static final int INDEX_VERSION

Always produce version 2 indexes, to get CRC data.

minBytesForObjectSizeIndexback to summary
private final int minBytesForObjectSizeIndex
objectListback to summary
pack-priv List<PackedObjectInfo> objectList
objectMapback to summary
pack-priv ObjectIdOwnerMap<PackedObjectInfo> objectMap
packDscback to summary
pack-priv DfsPackDescription packDsc
packKeyback to summary
pack-priv DfsStreamKey packKey
packOutback to summary
pack-priv DfsInserter.PackStream packOut
rollbackback to summary
private boolean rollback

Constructor Detail

DfsInserterback to summary
protected DfsInserter(DfsObjDatabase db)

Initialize a new inserter.

Parameters
db:DfsObjDatabase

database the inserter writes to.

Method Detail

beginObjectback to summary
private long beginObject(int type, long len) throws IOException
beginPackback to summary
private void beginPack() throws IOException
checkExistingback to summary
public void checkExisting(boolean check)

Check existence

Parameters
check:boolean

if false, will write out possibly-duplicate objects without first checking whether they exist in the repo; default is true.

clearback to summary
private void clear()
closeback to summary
public void close()

Implements abstract org.eclipse.jgit.lib.ObjectInserter.close.

Implements java.lang.AutoCloseable.close.

Doc from org.eclipse.jgit.lib.ObjectInserter.close.

Closes this resource, relinquishing any underlying resources. This method is invoked automatically on objects managed by the try-with-resources statement.

Release any resources used by this inserter.

An inserter that has been released can be used again, but may need to be released after the subsequent usage.

Annotations
@Override
endObjectback to summary
private ObjectId endObject(ObjectId id, long offset, long inflatedSize, int type)
flushback to summary
public void flush() throws IOException

Implements abstract org.eclipse.jgit.lib.ObjectInserter.flush.

Doc from org.eclipse.jgit.lib.ObjectInserter.flush.

Make all inserted objects visible.

The flush may take some period of time to make the objects available to other threads.

Annotations
@Override
Exceptions
IOException:
the flush could not be completed; objects inserted thus far are in an indeterminate state.
indexback to summary
private static void index(OutputStream out, byte[] packHash, List<PackedObjectInfo> list) throws IOException
insertback to summary
public ObjectId insert(int type, byte[] data, int off, int len) throws IOException

Overrides org.eclipse.jgit.lib.ObjectInserter.insert.

Doc from org.eclipse.jgit.lib.ObjectInserter.insert.

Insert a single object into the store, returning its unique name.

Parameters
type:int

type code of the object to store.

data:byte[]

complete content of the object.

off:int

first position within data.

len:int

number of bytes to copy from data.

Returns:ObjectId

the name of the object.

Annotations
@Override
Exceptions
IOException:
the object could not be stored.
insertback to summary
public ObjectId insert(int type, long len, InputStream in) throws IOException

Implements abstract org.eclipse.jgit.lib.ObjectInserter.insert.

Doc from org.eclipse.jgit.lib.ObjectInserter.insert.

Insert a single object into the store, returning its unique name.

Parameters
type:int

type code of the object to store.

len:long

number of bytes to copy from in.

in:InputStream

stream providing the object content. The caller is responsible for closing the stream.

Returns:ObjectId

the name of the object.

Annotations
@Override
Exceptions
IOException:
the object could not be stored, or the source stream could not be read.
insertBufferback to summary
private byte[] insertBuffer(long len)
maybeGetTemporaryBufferback to summary
private TemporaryBuffer.Heap maybeGetTemporaryBuffer(List<PackedObjectInfo> list)
Annotations
@Nullable
newPackParserback to summary
public DfsPackParser newPackParser(InputStream in) throws IOException

Implements abstract org.eclipse.jgit.lib.ObjectInserter.newPackParser.

Doc from org.eclipse.jgit.lib.ObjectInserter.newPackParser.

Initialize a parser to read from a pack formatted stream.

Parameters
in:InputStream

the input stream. The stream is not closed by the parser, and must instead be closed by the caller once parsing is complete.

Returns:DfsPackParser

the pack parser.

Annotations
@Override
Exceptions
IOException:
the parser instance, which can be configured and then used to parse objects into the ObjectDatabase.
newReaderback to summary
public ObjectReader newReader()

Implements abstract org.eclipse.jgit.lib.ObjectInserter.newReader.

Doc from org.eclipse.jgit.lib.ObjectInserter.newReader.

Open a reader for objects that may have been written by this inserter.

The returned reader allows the calling thread to read back recently inserted objects without first calling flush() to make them visible to the repository. The returned reader should only be used from the same thread as the inserter. Objects written by this inserter may not be visible to this.newReader().newReader().

The returned reader should return this inserter instance from ObjectReader#getCreatedFromInserter().

Behavior is undefined if an insert method is called on the inserter in the middle of reading from an ObjectStream opened from this reader. For example, reading the remainder of the object may fail, or newly written data may even be corrupted. Interleaving whole object reads (including streaming reads) with inserts is fine, just not interleaving streaming partial object reads with inserts.

Returns:ObjectReader

reader for any object, including an object recently inserted by this inserter since the last flush.

Annotations
@Override
setCompressionLevelback to summary
pack-priv void setCompressionLevel(int compression)
sortObjectsByIdback to summary
private void sortObjectsById()
writeObjectSizeIndexback to summary
pack-priv void writeObjectSizeIndex(DfsPackDescription pack, List<PackedObjectInfo> packedObjs) throws IOException
writePackIndexback to summary
pack-priv PackIndex writePackIndex(DfsPackDescription pack, byte[] packHash, List<PackedObjectInfo> list) throws IOException
org.eclipse.jgit.internal.storage.dfs back to summary

private Class DfsInserter.PackStream

extends OutputStream
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final int
pack-priv final DeflaterOutputStream
pack-priv final CRC32
private byte[]
private long
private int
private final Deflater
pack-priv final byte[]
private final MessageDigest
private final DfsOutputStream

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv void
beginObject(int objectType, long length)

public void
close()

Overrides java.io.OutputStream.close.

Implements java.io.Closeable.close.

Closes this output stream and releases any system resources associated with this stream.

private byte[]
copyOf(byte[] src, int ptr, int cnt)

private int
encodeTypeSize(int type, long rawLength)

private void
pack-priv long
private DfsBlock
getOrLoadBlock(long pos)

pack-priv byte[]
inflate(DfsReader ctx, long pos, int len)

pack-priv int
read(long pos, byte[] dst, int ptr, int cnt)

private int
setInput(long pos, Inflater inf)

private long
toBlockStart(long pos)

public void
write(int
the byte.
b
)

Implements abstract java.io.OutputStream.write.

Writes the specified byte to this output stream.

public void
write(byte[]
the data.
data
,
int
the start offset in the data.
off
,
int
the number of bytes to write.
len
)

Overrides java.io.OutputStream.write.

Writes len bytes from the specified byte array starting at offset off to this output stream.

private void
writeNoHash(byte[] data, int off, int len)

pack-priv byte[]
Inherited from java.io.OutputStream:
flushnullOutputStreamwrite

Field Detail

blockSizeback to summary
private final int blockSize
compressback to summary
pack-priv final DeflaterOutputStream compress
crc32back to summary
pack-priv final CRC32 crc32
currBufback to summary
private byte[] currBuf
currPosback to summary
private long currPos
currPtrback to summary
private int currPtr
deflaterback to summary
private final Deflater deflater
hdrBufback to summary
pack-priv final byte[] hdrBuf
mdback to summary
private final MessageDigest md
outback to summary
private final DfsOutputStream out

Constructor Detail

PackStreamback to summary
pack-priv PackStream(DfsOutputStream out)

Method Detail

beginObjectback to summary
pack-priv void beginObject(int objectType, long length) throws IOException
closeback to summary
public void close() throws IOException

Overrides java.io.OutputStream.close.

Implements java.io.Closeable.close.

Doc from java.io.OutputStream.close.

Closes this output stream and releases any system resources associated with this stream. The general contract of close is that it closes the output stream. A closed stream cannot perform output operations and cannot be reopened.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs.
copyOfback to summary
private byte[] copyOf(byte[] src, int ptr, int cnt)
encodeTypeSizeback to summary
private int encodeTypeSize(int type, long rawLength)
flushBlockback to summary
private void flushBlock() throws IOException
getCountback to summary
pack-priv long getCount()
getOrLoadBlockback to summary
private DfsBlock getOrLoadBlock(long pos) throws IOException
inflateback to summary
pack-priv byte[] inflate(DfsReader ctx, long pos, int len) throws IOException, DataFormatException
readback to summary
pack-priv int read(long pos, byte[] dst, int ptr, int cnt) throws IOException
setInputback to summary
private int setInput(long pos, Inflater inf) throws IOException, DataFormatException
toBlockStartback to summary
private long toBlockStart(long pos)
writeback to summary
public void write(int b) throws IOException

Implements abstract java.io.OutputStream.write.

Doc from java.io.OutputStream.write.

Writes the specified byte to this output stream. The general contract for write is that one byte is written to the output stream. The byte to be written is the eight low-order bits of the argument b. The 24 high-order bits of b are ignored.

Parameters
b:int

the byte.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs. In particular, an IOException may be thrown if the output stream has been closed.
writeback to summary
public void write(byte[] data, int off, int len) throws IOException

Overrides java.io.OutputStream.write.

Doc from java.io.OutputStream.write.

Writes len bytes from the specified byte array starting at offset off to this output stream. The general contract for write(b, off, len) is that some of the bytes in the array b are written to the output stream in order; element b[off] is the first byte written and b[off+len-1] is the last byte written by this operation.

If b is null, a NullPointerException is thrown.

If off is negative, or len is negative, or off+len is greater than the length of the array b, then an IndexOutOfBoundsException is thrown.

Parameters
data:byte[]

the data.

off:int

the start offset in the data.

len:int

the number of bytes to write.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs. In particular, an IOException is thrown if the output stream is closed.
writeNoHashback to summary
private void writeNoHash(byte[] data, int off, int len) throws IOException
writePackFooterback to summary
pack-priv byte[] writePackFooter() throws IOException
org.eclipse.jgit.internal.storage.dfs back to summary

private final Class DfsInserter.ReadBackStream

extends InputStream
Class Inheritance

Field Summary

Modifier and TypeField and Description
private long

Constructor Summary

AccessConstructor and Description
pack-priv
ReadBackStream(long offset)

Method Summary

Modifier and TypeMethod and Description
public int
read()

Implements abstract java.io.InputStream.read.

Reads the next byte of data from the input stream.

public int
read(byte[]
the buffer into which the data is read.
buf
,
int
the start offset in array b at which the data is written.
ptr
,
int
the maximum number of bytes to read.
len
)

Overrides java.io.InputStream.read.

Reads up to len bytes of data from the input stream into an array of bytes.

Inherited from java.io.InputStream:
availableclosemarkmarkSupportednullInputStreamreadreadAllBytesreadNBytesreadNBytesresetskipskipNBytestransferTo

Field Detail

posback to summary
private long pos

Constructor Detail

ReadBackStreamback to summary
pack-priv ReadBackStream(long offset)

Method Detail

readback to summary
public int read() throws IOException

Implements abstract java.io.InputStream.read.

Doc from java.io.InputStream.read.

Reads the next byte of data from the input stream. The value byte is returned as an int in the range 0 to 255. If no byte is available because the end of the stream has been reached, the value -1 is returned. This method blocks until input data is available, the end of the stream is detected, or an exception is thrown.

Returns:int

the next byte of data, or -1 if the end of the stream is reached.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs.
readback to summary
public int read(byte[] buf, int ptr, int len) throws IOException

Overrides java.io.InputStream.read.

Doc from java.io.InputStream.read.

Reads up to len bytes of data from the input stream into an array of bytes. An attempt is made to read as many as len bytes, but a smaller number may be read. The number of bytes actually read is returned as an integer.

This method blocks until input data is available, end of file is detected, or an exception is thrown.

If len is zero, then no bytes are read and 0 is returned; otherwise, there is an attempt to read at least one byte. If no byte is available because the stream is at end of file, the value -1 is returned; otherwise, at least one byte is read and stored into b.

The first byte read is stored into element b[off], the next one into b[off+1], and so on. The number of bytes read is, at most, equal to len. Let k be the number of bytes actually read; these bytes will be stored in elements b[off] through b[off+k-1], leaving elements b[off+k] through b[off+len-1] unaffected.

In every case, elements b[0] through b[off-1] and elements b[off+len] through b[b.length-1] are unaffected.

Parameters
buf:byte[]

the buffer into which the data is read.

ptr:int

the start offset in array b at which the data is written.

len:int

the maximum number of bytes to read.

Returns:int

the total number of bytes read into the buffer, or -1 if there is no more data because the end of the stream has been reached.

Annotations
@Override
Exceptions
IOException:
If the first byte cannot be read for any reason other than end of file, or if the input stream has been closed, or if some other I/O error occurs.
org.eclipse.jgit.internal.storage.dfs back to summary

private Class DfsInserter.Reader

extends ObjectReader
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final DfsReader
Inherited from org.eclipse.jgit.lib.ObjectReader:
OBJ_ANYstreamFileThreshold

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public void
close()

Implements abstract org.eclipse.jgit.lib.ObjectReader.close.

Implements java.lang.AutoCloseable.close.

Closes this resource, relinquishing any underlying resources.

public ObjectInserter
getCreatedFromInserter()

Overrides org.eclipse.jgit.lib.ObjectReader.getCreatedFromInserter.

Get the org.eclipse.jgit.lib.ObjectInserter from which this reader was created using inserter.newReader()

public Set<ObjectId>
getShallowCommits()

Implements abstract org.eclipse.jgit.lib.ObjectReader.getShallowCommits.

Returns IDs for those commits which should be considered as shallow.

public boolean
has(AnyObjectId
identity of the object to test for existence of.
objectId
)

Overrides org.eclipse.jgit.lib.ObjectReader.has.

Does the requested object exist in this database?

private byte[]
inflate(PackedObjectInfo obj, long zpos, int sz)

public ObjectReader
newReader()

Implements abstract org.eclipse.jgit.lib.ObjectReader.newReader.

Construct a new reader from the same data.

public ObjectLoader
open(AnyObjectId
identity of the object to open.
objectId
,
int
hint about the type of object being requested, e.g. org.eclipse.jgit.lib.Constants#OBJ_BLOB; OBJ_ANY if the object type is not known, or does not matter to the caller.
typeHint
)

Implements abstract org.eclipse.jgit.lib.ObjectReader.open.

Open an object from this database.

public Collection<ObjectId>
resolve(AbbreviatedObjectId
abbreviated id to resolve to a complete identity. The abbreviation must have a length of at least 2.
id
)

Implements abstract org.eclipse.jgit.lib.ObjectReader.resolve.

Resolve an abbreviated ObjectId to its full form.

Inherited from org.eclipse.jgit.lib.ObjectReader:
abbreviateabbreviatecreateObjectReachabilityCheckercreateReachabilityCheckergetBitmapIndexgetCommitGraphgetObjectSizegetObjectSizegetStreamFileThresholdhasisNotLargerThanopenopensetAvoidUnreachableObjectssetStreamFileThreshold

Field Detail

ctxback to summary
private final DfsReader ctx

Constructor Detail

Readerback to summary
private Reader()

Method Detail

closeback to summary
public void close()

Implements abstract org.eclipse.jgit.lib.ObjectReader.close.

Implements java.lang.AutoCloseable.close.

Doc from org.eclipse.jgit.lib.ObjectReader.close.

Closes this resource, relinquishing any underlying resources. This method is invoked automatically on objects managed by the try-with-resources statement.

Release any resources used by this reader.

A reader that has been released can be used again, but may need to be released after the subsequent usage.

Annotations
@Override
getCreatedFromInserterback to summary
public ObjectInserter getCreatedFromInserter()

Overrides org.eclipse.jgit.lib.ObjectReader.getCreatedFromInserter.

Doc from org.eclipse.jgit.lib.ObjectReader.getCreatedFromInserter.

Get the org.eclipse.jgit.lib.ObjectInserter from which this reader was created using inserter.newReader()

Returns:ObjectInserter

the org.eclipse.jgit.lib.ObjectInserter from which this reader was created using inserter.newReader(), or null if this reader was not created from an inserter.

Annotations
@Override
getShallowCommitsback to summary
public Set<ObjectId> getShallowCommits() throws IOException

Implements abstract org.eclipse.jgit.lib.ObjectReader.getShallowCommits.

Doc from org.eclipse.jgit.lib.ObjectReader.getShallowCommits.

Returns IDs for those commits which should be considered as shallow.

Returns:Set<ObjectId>

IDs of shallow commits

Annotations
@Override
Exceptions
IOException:
if an error occurred
hasback to summary
public boolean has(AnyObjectId objectId) throws IOException

Overrides org.eclipse.jgit.lib.ObjectReader.has.

Doc from org.eclipse.jgit.lib.ObjectReader.has.

Does the requested object exist in this database?

Parameters
objectId:AnyObjectId

identity of the object to test for existence of.

Returns:boolean

true if the specified object is stored in this database.

Annotations
@Override
Exceptions
IOException:
the object store cannot be accessed.
inflateback to summary
private byte[] inflate(PackedObjectInfo obj, long zpos, int sz) throws IOException, CorruptObjectException
newReaderback to summary
public ObjectReader newReader()

Implements abstract org.eclipse.jgit.lib.ObjectReader.newReader.

Doc from org.eclipse.jgit.lib.ObjectReader.newReader.

Construct a new reader from the same data.

Applications can use this method to build a new reader from the same data source, but for an different thread.

Returns:ObjectReader

a brand new reader, using the same data source.

Annotations
@Override
openback to summary
public ObjectLoader open(AnyObjectId objectId, int typeHint) throws IOException

Implements abstract org.eclipse.jgit.lib.ObjectReader.open.

Doc from org.eclipse.jgit.lib.ObjectReader.open.

Open an object from this database.

Parameters
objectId:AnyObjectId

identity of the object to open.

typeHint:int

hint about the type of object being requested, e.g. org.eclipse.jgit.lib.Constants#OBJ_BLOB; OBJ_ANY if the object type is not known, or does not matter to the caller.

Returns:ObjectLoader

a org.eclipse.jgit.lib.ObjectLoader for accessing the object.

Annotations
@Override
Exceptions
IOException:
the object store cannot be accessed.
resolveback to summary
public Collection<ObjectId> resolve(AbbreviatedObjectId id) throws IOException

Implements abstract org.eclipse.jgit.lib.ObjectReader.resolve.

Doc from org.eclipse.jgit.lib.ObjectReader.resolve.

Resolve an abbreviated ObjectId to its full form. This method searches for an ObjectId that begins with the abbreviation, and returns at least some matching candidates. If the returned collection is empty, no objects start with this abbreviation. The abbreviation doesn't belong to this repository, or the repository lacks the necessary objects to complete it. If the collection contains exactly one member, the abbreviation is (currently) unique within this database. There is a reasonably high probability that the returned id is what was previously abbreviated. If the collection contains 2 or more members, the abbreviation is not unique. In this case the implementation is only required to return at least 2 candidates to signal the abbreviation has conflicts. User friendly implementations should return as many candidates as reasonably possible, as the caller may be able to disambiguate further based on context. However since databases can be very large (e.g. 10 million objects) returning 625,000 candidates for the abbreviation "0" is simply unreasonable, so implementors should draw the line at around 256 matches.

Parameters
id:AbbreviatedObjectId

abbreviated id to resolve to a complete identity. The abbreviation must have a length of at least 2.

Returns:Collection<ObjectId>

candidates that begin with the abbreviated identity.

Annotations
@Override
Exceptions
IOException:
the object store cannot be read.
org.eclipse.jgit.internal.storage.dfs back to summary

private Class DfsInserter.StreamLoader

extends ObjectLoader
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final ObjectId
private final long
private final long
private final DfsStreamKey
private final int

Constructor Summary

AccessConstructor and Description
pack-priv
StreamLoader(ObjectId id, int type, long sz, DfsStreamKey key, long pos)

Method Summary

Modifier and TypeMethod and Description
public byte[]
getCachedBytes()

Implements abstract org.eclipse.jgit.lib.ObjectLoader.getCachedBytes.

Obtain a reference to the (possibly cached) bytes of this object.

public long
getSize()

Implements abstract org.eclipse.jgit.lib.ObjectLoader.getSize.

Get size of object in bytes

public int
getType()

Implements abstract org.eclipse.jgit.lib.ObjectLoader.getType.

Get Git in pack object type

public boolean
isLarge()

Overrides org.eclipse.jgit.lib.ObjectLoader.isLarge.

Whether this object is too large to obtain as a byte array.

public ObjectStream
openStream()

Implements abstract org.eclipse.jgit.lib.ObjectLoader.openStream.

Obtain an input stream to read this object's data.

Inherited from org.eclipse.jgit.lib.ObjectLoader:
copyTogetBytesgetBytesgetCachedBytes

Field Detail

idback to summary
private final ObjectId id
posback to summary
private final long pos
sizeback to summary
private final long size
srcPackback to summary
private final DfsStreamKey srcPack
typeback to summary
private final int type

Constructor Detail

StreamLoaderback to summary
pack-priv StreamLoader(ObjectId id, int type, long sz, DfsStreamKey key, long pos)

Method Detail

getCachedBytesback to summary
public byte[] getCachedBytes() throws LargeObjectException

Implements abstract org.eclipse.jgit.lib.ObjectLoader.getCachedBytes.

Doc from org.eclipse.jgit.lib.ObjectLoader.getCachedBytes.

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.

Returns:byte[]

the cached bytes of this object. Do not modify it.

Annotations
@Override
Exceptions
LargeObjectException:
if the object won't fit into a byte array, because isLarge() returns true. Callers should use openStream() instead to access the contents.
getSizeback to summary
public long getSize()

Implements abstract org.eclipse.jgit.lib.ObjectLoader.getSize.

Doc from org.eclipse.jgit.lib.ObjectLoader.getSize.

Get size of object in bytes

Returns:long

size of object in bytes

Annotations
@Override
getTypeback to summary
public int getType()

Implements abstract org.eclipse.jgit.lib.ObjectLoader.getType.

Doc from org.eclipse.jgit.lib.ObjectLoader.getType.

Get Git in pack object type

Returns:int

Git in pack object type, see org.eclipse.jgit.lib.Constants.

Annotations
@Override
isLargeback to summary
public boolean isLarge()

Overrides org.eclipse.jgit.lib.ObjectLoader.isLarge.

Doc from org.eclipse.jgit.lib.ObjectLoader.isLarge.

Whether this object is too large to obtain as a byte array.

Returns:boolean

true if this object is too large to obtain as a byte array. Objects over a certain threshold should be accessed only by their openStream() to prevent overflowing the JVM heap.

Annotations
@Override
openStreamback to summary
public ObjectStream openStream() throws IOException

Implements abstract org.eclipse.jgit.lib.ObjectLoader.openStream.

Doc from org.eclipse.jgit.lib.ObjectLoader.openStream.

Obtain an input stream to read this object's data.

Returns:ObjectStream

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.

Annotations
@Override
Exceptions
IOException:
the object store cannot be accessed.