You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by "iverase (via GitHub)" <gi...@apache.org> on 2023/09/27 13:26:16 UTC
[GitHub] [lucene] iverase opened a new issue, #12599: Add readBytes method to RandomAccessInput
iverase opened a new issue, #12599:
URL: https://github.com/apache/lucene/issues/12599
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.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org
Re: [I] Add readBytes method to RandomAccessInput [lucene]
Posted by "iverase (via GitHub)" <gi...@apache.org>.
iverase closed issue #12599: Add readBytes method to RandomAccessInput
URL: https://github.com/apache/lucene/issues/12599
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org