-
Couldn't load subscription status.
- Fork 1.2k
Closed
Description
We can currently read a RandomAccessInput byte by byte but it does not provide a method to bulk read a chunck of bytes, similary to what DataInput provides with DataInput#readBytes(byte[], int, int). Therefore I would like to propose to add it with a default implementation that reads bye per byte:
/**
* Reads a specified number of bytes starting at a given position into an array at the specified
* offset.
*
* @see DataInput#readBytes
*/
default void readBytes(long pos, byte[] bytes, int offset, int length) throws IOException {
for (int i = 0; i < length; i++) {
bytes[offset + i] = readByte(pos + i);
}
}
We can add faster implementation for all know implementations in Lucene code base.
Metadata
Metadata
Assignees
Labels
No labels