Class BlockWriter
java.lang.Object
org.eclipse.jgit.internal.storage.reftable.BlockWriter
Formats and writes blocks for
ReftableWriter.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static class(package private) static class(package private) static class(package private) static class(package private) static class(package private) static class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final intprivate final byteprivate final List<BlockWriter.Entry>private intprivate final byteprivate intprivate final int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate BlockSizeTooSmallException(package private) byte(package private) static intcommonPrefix(byte[] a, int n, byte[] b) (package private) static intcompare(byte[] a, int ai, int aLen, byte[] b, int bi, int bLen) private intcomputeBlockBytes(int entryBytes, boolean restart) private static intcomputeBlockBytes(int entryBytes, int restartCnt) (package private) int(package private) static intencodeSuffixAndType(int sfx, int valueType) private static intestimateEntryCount(byte blockType, byte keyType, int blockLimitBytes) (package private) byte[]lastKey()(package private) voidmustAdd(BlockWriter.Entry entry) private boolean(package private) boolean(package private) static booleanpadBetweenBlocks(byte type) (package private) booleantryAdd(BlockWriter.Entry entry) private booleantryAdd(BlockWriter.Entry entry, boolean tryRestart) (package private) void
-
Field Details
-
blockType
private final byte blockType -
keyType
private final byte keyType -
entries
-
blockLimitBytes
private final int blockLimitBytes -
restartInterval
private final int restartInterval -
entriesSumBytes
private int entriesSumBytes -
restartCnt
private int restartCnt
-
-
Constructor Details
-
BlockWriter
BlockWriter(byte type, byte kt, int bs, int ri)
-
-
Method Details
-
estimateEntryCount
private static int estimateEntryCount(byte blockType, byte keyType, int blockLimitBytes) -
blockType
byte blockType() -
padBetweenBlocks
boolean padBetweenBlocks() -
padBetweenBlocks
static boolean padBetweenBlocks(byte type) -
lastKey
byte[] lastKey() -
currentSize
int currentSize() -
mustAdd
- Throws:
BlockSizeTooSmallException
-
tryAdd
-
tryAdd
-
nextShouldBeRestart
private boolean nextShouldBeRestart() -
computeBlockBytes
private int computeBlockBytes(int entryBytes, boolean restart) -
computeBlockBytes
private static int computeBlockBytes(int entryBytes, int restartCnt) -
writeTo
- Throws:
IOException
-
blockSizeTooSmall
-
commonPrefix
static int commonPrefix(byte[] a, int n, byte[] b) -
encodeSuffixAndType
static int encodeSuffixAndType(int sfx, int valueType) -
compare
static int compare(byte[] a, int ai, int aLen, byte[] b, int bi, int bLen)
-