Top Description Inners Fields Constructors Methods
org.eclipse.jgit.lib

public abstract Class ObjectInserter

extends Object
implements AutoCloseable
Class Inheritance
All Implemented Interfaces
java.lang.AutoCloseable
Known Direct Subclasses
org.eclipse.jgit.lib.ObjectInserter.Formatter, org.eclipse.jgit.lib.ObjectInserter.Filter, org.eclipse.jgit.internal.storage.dfs.DfsInserter, org.eclipse.jgit.internal.storage.file.ObjectDirectoryInserter, org.eclipse.jgit.internal.storage.file.PackInserter
Imports
java.io.ByteArrayInputStream, .EOFException, .IOException, .InputStream, org.eclipse.jgit.internal.JGitText, org.eclipse.jgit.transport.PackParser, org.eclipse.jgit.util.sha1.SHA1

Inserts objects into an existing ObjectDatabase.

An inserter is not thread-safe. Individual threads should each obtain their own unique inserter instance, or must arrange for locking at a higher level to ensure the inserter is in use by no more than one thread at a time.

Objects written by an inserter may not be immediately visible for reading after the insert method completes. Callers must invoke either close() or flush() prior to updating references or otherwise making the returned ObjectIds visible to other code.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public abstract static class
ObjectInserter.Filter

Wraps a delegate ObjectInserter.

public static class
ObjectInserter.Formatter

An inserter that can be used for formatting and id generation only.

Field Summary

Modifier and TypeField and Description
private final SHA1
private byte[]
tempBuffer

Temporary working buffer for streaming data through.

Constructor Summary

AccessConstructor and Description
protected
ObjectInserter()

Create a new inserter for a database.

Method Summary

Modifier and TypeMethod and Description
protected byte[]

Returns:

a temporary byte array for use by the caller.
buffer
()

Obtain a temporary buffer for use by the ObjectInserter or its subclass.

public abstract void
close()

Redeclares java.lang.AutoCloseable.close.

Closes this resource, relinquishing any underlying resources.

protected SHA1

Returns:

digest to help compute an ObjectId
digest
()

Compute digest to help compute an ObjectId

public abstract void
flush()

Make all inserted objects visible.

public ObjectId

Returns:

the name of the object.
idFor
(int
type code of the object to store.
type
,
byte[]
complete content of the object.
data
)

Compute the name of an object, without inserting it.

public ObjectId

Returns:

the name of the object.
idFor
(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
)

Compute the name of an object, without inserting it.

public ObjectId

Returns:

the name of the object.
idFor
(int
type code of the object to store.
objectType
,
long
number of bytes to scan from in.
length
,
InputStream
stream providing the object content. The caller is responsible for closing the stream.
in
)

Compute the name of an object, without inserting it.

public ObjectId

Returns:

the computed ObjectId
idFor
(TreeFormatter formatter)

Compute the ObjectId for the given tree without inserting it.

public final ObjectId

Returns:

the name of the tree object.
insert
(TreeFormatter
the formatter containing the proposed tree's data.
formatter
)

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

public final ObjectId

Returns:

the name of the commit object.
insert
(CommitBuilder
the builder containing the proposed commit's data.
builder
)

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

public final ObjectId

Returns:

the name of the tag object.
insert
(TagBuilder
the builder containing the proposed tag's data.
builder
)

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

public ObjectId

Returns:

the name of the object.
insert
(int
type code of the object to store.
type
,
byte[]
complete content of the object.
data
)

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

public ObjectId

Returns:

the name of the object.
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
)

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

public abstract ObjectId

Returns:

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

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

public abstract PackParser

Returns:

the pack parser.
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
)

Initialize a parser to read from a pack formatted stream.

public abstract ObjectReader

Returns:

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

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

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

hasherback to summary
private final SHA1 hasher
tempBufferback to summary
private byte[] tempBuffer

Temporary working buffer for streaming data through.

Constructor Detail

ObjectInserterback to summary
protected ObjectInserter()

Create a new inserter for a database.

Method Detail

bufferback to summary
protected byte[] buffer()

Obtain a temporary buffer for use by the ObjectInserter or its subclass.

This buffer is supplied by the ObjectInserter base class to itself and its subclasses for the purposes of pulling data from a supplied InputStream, passing it through a Deflater, or formatting the canonical format of a small object like a small tree or commit.

This buffer IS NOT for translation such as auto-CRLF or content filtering and must not be used for such purposes.

The returned buffer is small, around a few KiBs, and the size may change between versions of JGit. Callers using this buffer must always check the length of the returned array to ascertain how much space was provided.

There is a single buffer for each ObjectInserter, repeated calls to this method will (usually) always return the same buffer. If the caller needs more than one buffer, or needs a buffer of a larger size, it must manage that buffer on its own.

The buffer is usually on first demand for a buffer.

Returns:byte[]

a temporary byte array for use by the caller.

closeback to summary
public abstract void close()

Redeclares java.lang.AutoCloseable.close.

Doc from java.lang.AutoCloseable.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
Since
4.0
digestback to summary
protected SHA1 digest()

Compute digest to help compute an ObjectId

Returns:SHA1

digest to help compute an ObjectId

Since
4.7
flushback to summary
public abstract void flush() throws IOException

Make all inserted objects visible.

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

Exceptions
IOException:
the flush could not be completed; objects inserted thus far are in an indeterminate state.
idForback to summary
public ObjectId idFor(int type, byte[] data)

Compute the name of an object, without inserting it.

Parameters
type:int

type code of the object to store.

data:byte[]

complete content of the object.

Returns:ObjectId

the name of the object.

idForback to summary
public ObjectId idFor(int type, byte[] data, int off, int len)

Compute the name of an object, without inserting it.

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.

idForback to summary
public ObjectId idFor(int objectType, long length, InputStream in) throws IOException

Compute the name of an object, without inserting it.

Parameters
objectType:int

type code of the object to store.

length:long

number of bytes to scan from in.

in:InputStream

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

Returns:ObjectId

the name of the object.

Exceptions
IOException:
the source stream could not be read.
idForback to summary
public ObjectId idFor(TreeFormatter formatter)

Compute the ObjectId for the given tree without inserting it.

Parameters
formatter:TreeFormatter

a org.eclipse.jgit.lib.TreeFormatter object.

Returns:ObjectId

the computed ObjectId

insertback to summary
public final ObjectId insert(TreeFormatter formatter) throws IOException

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

Parameters
formatter:TreeFormatter

the formatter containing the proposed tree's data.

Returns:ObjectId

the name of the tree object.

Exceptions
IOException:
the object could not be stored.
insertback to summary
public final ObjectId insert(CommitBuilder builder) throws IOException

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

Parameters
builder:CommitBuilder

the builder containing the proposed commit's data.

Returns:ObjectId

the name of the commit object.

Exceptions
IOException:
the object could not be stored.
insertback to summary
public final ObjectId insert(TagBuilder builder) throws IOException

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

Parameters
builder:TagBuilder

the builder containing the proposed tag's data.

Returns:ObjectId

the name of the tag object.

Exceptions
IOException:
the object could not be stored.
insertback to summary
public ObjectId insert(int type, byte[] data) throws IOException

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.

Returns:ObjectId

the name of the object.

Exceptions
IOException:
the object could not be stored.
insertback to summary
public ObjectId insert(int type, byte[] data, int off, int len) throws IOException

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.

Exceptions
IOException:
the object could not be stored.
insertback to summary
public abstract ObjectId insert(int objectType, long length, InputStream in) throws IOException

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

Parameters
objectType:int

type code of the object to store.

length: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.

Exceptions
IOException:
the object could not be stored, or the source stream could not be read.
newPackParserback to summary
public abstract PackParser newPackParser(InputStream in) throws IOException

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:PackParser

the pack parser.

Exceptions
IOException:
the parser instance, which can be configured and then used to parse objects into the ObjectDatabase.
newReaderback to summary
public abstract ObjectReader 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.

Since
3.5
org.eclipse.jgit.lib back to summary

public abstract Class ObjectInserter.Filter

extends ObjectInserter
Class Inheritance

Wraps a delegate ObjectInserter.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected byte[]
buffer()

Overrides org.eclipse.jgit.lib.ObjectInserter.buffer.

Obtain a temporary buffer for use by the ObjectInserter or its subclass.

public void
close()

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

Implements java.lang.AutoCloseable.close.

Closes this resource, relinquishing any underlying resources.

protected abstract ObjectInserter

Returns:

delegate ObjectInserter to handle all processing.
delegate
()

Get delegate ObjectInserter to handle all processing

public void
flush()

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

Make all inserted objects visible.

public ObjectId
idFor(int
type code of the object to store.
type
,
byte[]
complete content of the object.
data
)

Overrides org.eclipse.jgit.lib.ObjectInserter.idFor.

Compute the name of an object, without inserting it.

public ObjectId
idFor(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.idFor.

Compute the name of an object, without inserting it.

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

Overrides org.eclipse.jgit.lib.ObjectInserter.idFor.

Compute the name of an object, without inserting it.

public ObjectId
idFor(TreeFormatter formatter)

Overrides org.eclipse.jgit.lib.ObjectInserter.idFor.

Compute the ObjectId for the given tree without inserting it.

public ObjectId
insert(int
type code of the object to store.
type
,
byte[]
complete content of the object.
data
)

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
,
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.
objectType
,
long
number of bytes to copy from in.
length
,
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.

public PackParser
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.

Inherited from org.eclipse.jgit.lib.ObjectInserter:
digestinsertinsertinsert

Constructor Detail

Filterback to summary
public Filter()

Method Detail

bufferback to summary
protected byte[] buffer()

Overrides org.eclipse.jgit.lib.ObjectInserter.buffer.

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

Obtain a temporary buffer for use by the ObjectInserter or its subclass.

This buffer is supplied by the ObjectInserter base class to itself and its subclasses for the purposes of pulling data from a supplied InputStream, passing it through a Deflater, or formatting the canonical format of a small object like a small tree or commit.

This buffer IS NOT for translation such as auto-CRLF or content filtering and must not be used for such purposes.

The returned buffer is small, around a few KiBs, and the size may change between versions of JGit. Callers using this buffer must always check the length of the returned array to ascertain how much space was provided.

There is a single buffer for each ObjectInserter, repeated calls to this method will (usually) always return the same buffer. If the caller needs more than one buffer, or needs a buffer of a larger size, it must manage that buffer on its own.

The buffer is usually on first demand for a buffer.

Returns:byte[]

a temporary byte array for use by the caller.

Annotations
@Override
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
delegateback to summary
protected abstract ObjectInserter delegate()

Get delegate ObjectInserter to handle all processing

Returns:ObjectInserter

delegate ObjectInserter to handle all processing.

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.
idForback to summary
public ObjectId idFor(int type, byte[] data)

Overrides org.eclipse.jgit.lib.ObjectInserter.idFor.

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

Compute the name of an object, without inserting it.

Parameters
type:int

type code of the object to store.

data:byte[]

complete content of the object.

Returns:ObjectId

the name of the object.

Annotations
@Override
idForback to summary
public ObjectId idFor(int type, byte[] data, int off, int len)

Overrides org.eclipse.jgit.lib.ObjectInserter.idFor.

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

Compute the name of an object, without inserting it.

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
idForback to summary
public ObjectId idFor(int objectType, long length, InputStream in) throws IOException

Overrides org.eclipse.jgit.lib.ObjectInserter.idFor.

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

Compute the name of an object, without inserting it.

Parameters
objectType:int

type code of the object to store.

length:long

number of bytes to scan 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 source stream could not be read.
idForback to summary
public ObjectId idFor(TreeFormatter formatter)

Overrides org.eclipse.jgit.lib.ObjectInserter.idFor.

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

Compute the ObjectId for the given tree without inserting it.

Parameters
formatter:TreeFormatter

a org.eclipse.jgit.lib.TreeFormatter object.

Returns:ObjectId

the computed ObjectId

Annotations
@Override
insertback to summary
public ObjectId insert(int type, byte[] data) 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.

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, 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 objectType, long length, 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
objectType:int

type code of the object to store.

length: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.
newPackParserback to summary
public PackParser 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:PackParser

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
org.eclipse.jgit.lib back to summary

public Class ObjectInserter.Formatter

extends ObjectInserter
Class Inheritance

An inserter that can be used for formatting and id generation only.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
close()

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

Implements java.lang.AutoCloseable.close.

Closes this resource, relinquishing any underlying resources.

public void
flush()

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

Make all inserted objects visible.

public ObjectId
insert(int
type code of the object to store.
objectType
,
long
number of bytes to copy from in.
length
,
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.

public PackParser
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.

Inherited from org.eclipse.jgit.lib.ObjectInserter:
bufferdigestidForidForidForidForinsertinsertinsertinsertinsert

Constructor Detail

Formatterback to summary
public Formatter()

Method Detail

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
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.
insertback to summary
public ObjectId insert(int objectType, long length, 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
objectType:int

type code of the object to store.

length: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.
newPackParserback to summary
public PackParser 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:PackParser

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