Skip to content

Commit 11ab1fa

Browse files
committed
Fix the readBytes method
1 parent c12e892 commit 11ab1fa

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

lucene/core/src/java/org/apache/lucene/util/fst/ByteBlockPoolReverseBytesReader.java

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,8 @@ public byte readByte() throws IOException {
3838

3939
@Override
4040
public void readBytes(byte[] b, int offset, int len) throws IOException {
41-
// first read the bytes as-is
42-
buf.readBytes(pos, b, offset, len);
43-
pos -= len;
44-
45-
// then revert the bytes
46-
int limit = len / 2;
47-
for (int i = 0; i < limit; i++) {
48-
byte tmp = b[offset + i];
49-
b[offset + i] = b[offset + len - i - 1];
50-
b[offset + len - i - 1] = tmp;
41+
for (int i = 0; i < len; i++) {
42+
b[offset + i] = readByte();
5143
}
5244
}
5345

0 commit comments

Comments
 (0)