Top Description Fields Constructors Methods
org.eclipse.jgit.internal.storage.file

public abstract Class PackReverseIndexWriter

extends Object
Class Inheritance
Known Direct Subclasses
org.eclipse.jgit.internal.storage.file.PackReverseIndexWriterV1
Static Imports
org.eclipse.jgit.internal.storage.file.PackReverseIndex.VERSION_1

Writes reverse index files conforming to the requested version.

The reverse index file format is specified at https://git-scm.com/docs/pack-format#_pack_rev_files_have_the_format.

Field Summary

Modifier and TypeField and Description
protected final DataOutput
dataOutput

Stream to write primitive type contents to while maintaining a checksum.

private static final int
protected final DigestOutputStream
out

Stream to write contents to while maintaining a checksum.

Constructor Summary

AccessConstructor and Description
protected
PackReverseIndexWriter(OutputStream
the OutputStream that the instance will write contents to
dst
)

Construct the components of a PackReverseIndexWriter that are shared between subclasses.

Method Summary

Modifier and TypeMethod and Description
public static PackReverseIndexWriter

Returns:

the new writer instance
createWriter
(OutputStream
the OutputStream that contents will be written to
dst
)

Create a writer instance for the default file format version.

public static PackReverseIndexWriter

Returns:

the new writer instance
createWriter
(OutputStream
the OutputStream that contents will be written to
dst
,
int
the reverse index format version to write contents as
version
)

Create a writer instance for the specified file format version.

public void
write(List<? extends PackedObjectInfo>
the objects whose forward index file positions should be written, sorted by forward index file position (currently SHA1 ordering)
objectsByIndexPos
,
byte[]
the checksum of the corresponding pack file
packChecksum
)

Write the contents of a reverse index file for the given objects.

protected abstract void
writeBody(List<? extends PackedObjectInfo>
the objects whose forward index file positions should be written, sorted by forward index file position; not modified during method
objectsSortedByIndexPosition
)

Write the body of a reverse index file, usually the forward index positions of the given objects, sorted by those objects' pack file offsets.

private void
writeFooter(byte[] packChecksum)

protected abstract void
writeHeader()

Write the header of a reverse index file, usually the magic bytes and the file format version.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

dataOutputback to summary
protected final DataOutput dataOutput

Stream to write primitive type contents to while maintaining a checksum.

DEFAULT_VERSIONback to summary
private static final int DEFAULT_VERSION
outback to summary
protected final DigestOutputStream out

Stream to write contents to while maintaining a checksum.

Constructor Detail

PackReverseIndexWriterback to summary
protected PackReverseIndexWriter(OutputStream dst)

Construct the components of a PackReverseIndexWriter that are shared between subclasses.

Parameters
dst:OutputStream

the OutputStream that the instance will write contents to

Method Detail

createWriterback to summary
public static PackReverseIndexWriter createWriter(OutputStream dst)

Create a writer instance for the default file format version.

Parameters
dst:OutputStream

the OutputStream that contents will be written to

Returns:PackReverseIndexWriter

the new writer instance

createWriterback to summary
public static PackReverseIndexWriter createWriter(OutputStream dst, int version)

Create a writer instance for the specified file format version.

Parameters
dst:OutputStream

the OutputStream that contents will be written to

version:int

the reverse index format version to write contents as

Returns:PackReverseIndexWriter

the new writer instance

writeback to summary
public void write(List<? extends PackedObjectInfo> objectsByIndexPos, byte[] packChecksum) throws IOException

Write the contents of a reverse index file for the given objects.

Parameters
objectsByIndexPos:List<? extends PackedObjectInfo>

the objects whose forward index file positions should be written, sorted by forward index file position (currently SHA1 ordering)

packChecksum:byte[]

the checksum of the corresponding pack file

Exceptions
IOException:
if writing the output fails
writeBodyback to summary
protected abstract void writeBody(List<? extends PackedObjectInfo> objectsSortedByIndexPosition) throws IOException

Write the body of a reverse index file, usually the forward index positions of the given objects, sorted by those objects' pack file offsets.

Parameters
objectsSortedByIndexPosition:List<? extends PackedObjectInfo>

the objects whose forward index file positions should be written, sorted by forward index file position; not modified during method

Exceptions
IOException:
if writing the output fails
writeFooterback to summary
private void writeFooter(byte[] packChecksum) throws IOException
writeHeaderback to summary
protected abstract void writeHeader() throws IOException

Write the header of a reverse index file, usually the magic bytes and the file format version.

Exceptions
IOException:
if writing the output fails