Skip to content

Commit

Permalink
use growExact
Browse files Browse the repository at this point in the history
  • Loading branch information
easyice committed Jan 7, 2024
1 parent 9aaca66 commit fd950c0
Showing 1 changed file with 3 additions and 2 deletions.
Expand Up @@ -128,8 +128,9 @@ public void decompress(DataInput in, int originalLength, int offset, int length,
}

// Read blocks that intersect with the interval we need
if (offsetInBlock < offset + length) {
bytes.bytes = ArrayUtil.grow(bytes.bytes, bytes.length + offset + length - offsetInBlock);
int bytesNeeded = bytes.length + offset + length - offsetInBlock;
if (offsetInBlock < offset + length && bytes.bytes.length < bytesNeeded) {
bytes.bytes = ArrayUtil.growExact(bytes.bytes, bytesNeeded);
}
while (offsetInBlock < offset + length) {
final int bytesToDecompress = Math.min(blockLength, offset + length - offsetInBlock);
Expand Down

0 comments on commit fd950c0

Please sign in to comment.