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

pack-priv Class ReftableOutputStream

extends OutputStream
Class Inheritance
Static Imports
java.nio.charset.StandardCharsets.UTF_8, org.eclipse.jgit.internal.storage.reftable.ReftableConstants.FILE_HEADER_LEN, .ReftableConstants.INDEX_BLOCK_TYPE, .ReftableConstants.LOG_BLOCK_TYPE, org.eclipse.jgit.lib.Constants.OBJECT_ID_LENGTH

Wrapper to assist formatting a reftable to an OutputStream.

Internally buffers at block size boundaries, flushing only complete blocks to the OutputStream.

Field Summary

Modifier and TypeField and Description
private final boolean
private byte[]
private int
private int
private int
private DeflaterOutputStream
private int
private Deflater
private final CountingOutputStream
private long
private final byte[]

Constructor Summary

AccessConstructor and Description
pack-priv
ReftableOutputStream(OutputStream os, int bs, boolean align)

Method Summary

Modifier and TypeMethod and Description
pack-priv void
beginBlock(byte type)

pack-priv int
pack-priv int
pack-priv static int
private void
pack-priv int
estimatePadBetweenBlocks(int currentBlockSize)

pack-priv void
pack-priv void
pack-priv void
pack-priv void
pack-priv long
pack-priv void
setBlockSize(int bs)

pack-priv long

Returns:

bytes flushed; excludes bytesWrittenInBlock().
size
()

Get size

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.
b
,
int
the start offset in the data.
off
,
int
the number of bytes to write.
cnt
)

Overrides java.io.OutputStream.write.

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

pack-priv void
pack-priv void
writeInt16(int val)

pack-priv void
writeInt24(int val)

pack-priv void
writeVarint(long val)

pack-priv void
pack-priv void
writeVarintString(byte[] msg)

Inherited from java.io.OutputStream:
closeflushnullOutputStreamwrite

Field Detail

alignBlocksback to summary
private final boolean alignBlocks
blockBufback to summary
private byte[] blockBuf
blockSizeback to summary
private int blockSize
blockStartback to summary
private int blockStart
blockTypeback to summary
private int blockType
compressorback to summary
private DeflaterOutputStream compressor
curback to summary
private int cur
deflaterback to summary
private Deflater deflater
outback to summary
private final CountingOutputStream out
paddingUsedback to summary
private long paddingUsed
tmpback to summary
private final byte[] tmp

Constructor Detail

ReftableOutputStreamback to summary
pack-priv ReftableOutputStream(OutputStream os, int bs, boolean align)

Method Detail

beginBlockback to summary
pack-priv void beginBlock(byte type)
bytesAvailableInBlockback to summary
pack-priv int bytesAvailableInBlock()
bytesWrittenInBlockback to summary
pack-priv int bytesWrittenInBlock()
computeVarintSizeback to summary
pack-priv static int computeVarintSize(long val)
ensureBytesAvailableInBlockBufback to summary
private void ensureBytesAvailableInBlockBuf(int cnt)
estimatePadBetweenBlocksback to summary
pack-priv int estimatePadBetweenBlocks(int currentBlockSize)
finishFileback to summary
pack-priv void finishFile() throws IOException
flushBlockback to summary
pack-priv void flushBlock() throws IOException
flushFileHeaderback to summary
pack-priv void flushFileHeader() throws IOException
padBetweenBlocksToNextBlockback to summary
pack-priv void padBetweenBlocksToNextBlock() throws IOException
paddingUsedback to summary
pack-priv long paddingUsed()
setBlockSizeback to summary
pack-priv void setBlockSize(int bs)
sizeback to summary
pack-priv long size()

Get size

Returns:long

bytes flushed; excludes bytesWrittenInBlock().

writeback to summary
public void write(int b)

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
writeback to summary
public void write(byte[] b, int off, int cnt)

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
b:byte[]

the data.

off:int

the start offset in the data.

cnt:int

the number of bytes to write.

Annotations
@Override
writeIdback to summary
pack-priv void writeId(ObjectId id)
writeInt16back to summary
pack-priv void writeInt16(int val)
writeInt24back to summary
pack-priv void writeInt24(int val)
writeVarintback to summary
pack-priv void writeVarint(long val)
writeVarintStringback to summary
pack-priv void writeVarintString(String s)
writeVarintStringback to summary
pack-priv void writeVarintString(byte[] msg)