Class BlockReader
java.lang.Object
org.eclipse.jgit.internal.storage.reftable.BlockReader
Reads a single block for
ReftableReader. Instances are tied to a
specific block in the file so are not reused for other blocks. Instances hold
an offset into the block.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate byteprivate byte[]private intprivate longprivate intprivate intprivate byte[]private intprivate intprivate intprivate intprivate int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static intdecodeBlockLen(int typeAndSize) (package private) longprivate longinflateBuf(BlockSource src, long pos, int blockLen, int fileBlockSize) private static IOExceptionprivate static IOExceptioninvalidBlock(Throwable cause) (package private) booleanmatch(byte[] match, boolean matchIsPrefix) (package private) Stringname()private static Ref(package private) booleannext()private voidparseBlockStart(BlockSource src, long pos, int fileBlockSize) (package private) voidparseKey()(package private) voidreadBlock(BlockSource src, long pos, int fileBlockSize) private voidreadBlockIntoBuf(BlockSource src, long pos, int size) (package private) LongListprivate short(package private) ReflogEntry(package private) longprivate PersonIdent(package private) long(package private) RefreadRef(long minUpdateIndex) (package private) longprivate ObjectIdprivate Stringprivate intprivate longprivate intscanToKey(byte[] key, int rPtr, int rIdx, int rCmp) Performs the linear search step within a restart interval.(package private) intseekKey(byte[] key) Finds a key in the block and positions the current pointer on its record.private voidprivate void(package private) void(package private) bytetype()(package private) void
-
Field Details
-
blockType
private byte blockType -
endPosition
private long endPosition -
buf
private byte[] buf -
bufLen
private int bufLen -
ptr
private int ptr -
keysStart
private int keysStart -
keysEnd
private int keysEnd -
restartCnt
private int restartCnt -
restartTbl
private int restartTbl -
nameBuf
private byte[] nameBuf -
nameLen
private int nameLen -
valueType
private int valueType
-
-
Constructor Details
-
BlockReader
BlockReader()
-
-
Method Details
-
type
byte type() -
endPosition
long endPosition() -
next
boolean next() -
parseKey
void parseKey() -
name
String name() -
match
boolean match(byte[] match, boolean matchIsPrefix) -
readPositionFromIndex
- Throws:
IOException
-
readUpdateIndexDelta
long readUpdateIndexDelta() -
readRef
- Throws:
IOException
-
readBlockPositionList
-
readLogUpdateIndex
long readLogUpdateIndex() -
readLogEntry
-
readValueId
-
readValueString
-
readPersonIdent
-
readBlock
- Throws:
IOException
-
readBlockIntoBuf
- Throws:
IOException
-
parseBlockStart
- Throws:
IOException
-
decodeBlockLen
static int decodeBlockLen(int typeAndSize) -
inflateBuf
private long inflateBuf(BlockSource src, long pos, int blockLen, int fileBlockSize) throws IOException - Throws:
IOException
-
setupEmptyFileBlock
private void setupEmptyFileBlock() -
verifyIndex
- Throws:
IOException
-
seekKey
int seekKey(byte[] key) Finds a key in the block and positions the current pointer on its record.As a side-effect this method arranges for the current pointer to be near or exactly on
key, allowing other methods to access data from that current record:- Parameters:
key- key to find.- Returns:
<0if the key occurs before the start of this block;0if the block is positioned on the key;>0if the key occurs after the last key of this block.
-
scanToKey
private int scanToKey(byte[] key, int rPtr, int rIdx, int rCmp) Performs the linear search step within a restart interval.Starts at a restart position whose key sorts before (or equal to)
keyand walks sequentially through the following prefix compressed records to findkey.- Parameters:
key- key the caller wants to find.rPtr- current record pointer from restart table binary search.rIdx- current restart table index.rCmp- result of compare from restart table binary search.- Returns:
<0if the key occurs before the start of this block;0if the block is positioned on the key;>0if the key occurs after the last key of this block.
-
skipValue
void skipValue() -
skipString
private void skipString() -
readInt16
private short readInt16() -
readVarint32
private int readVarint32() -
readVarint64
private long readVarint64() -
newRef
-
invalidBlock
-
invalidBlock
-