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 int
private final byte
private final List
<BlockWriter.Entry> private int
private final byte
private int
private final int
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate BlockSizeTooSmallException
(package private) byte
(package private) static int
commonPrefix
(byte[] a, int n, byte[] b) (package private) static int
compare
(byte[] a, int ai, int aLen, byte[] b, int bi, int bLen) private int
computeBlockBytes
(int entryBytes, boolean restart) private static int
computeBlockBytes
(int entryBytes, int restartCnt) (package private) int
(package private) static int
encodeSuffixAndType
(int sfx, int valueType) private static int
estimateEntryCount
(byte blockType, byte keyType, int blockLimitBytes) (package private) byte[]
lastKey()
(package private) void
mustAdd
(BlockWriter.Entry entry) private boolean
(package private) boolean
(package private) static boolean
padBetweenBlocks
(byte type) (package private) boolean
tryAdd
(BlockWriter.Entry entry) private boolean
tryAdd
(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)
-