This is an automated email from the ASF dual-hosted git repository.
dongjoon pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/orc.git
The following commit(s) were added to refs/heads/main by this push:
new 75bde1f64 ORC-2048: Use Java `InputStream.skipNBytes` instead of
`IOUtils.skipFully`
75bde1f64 is described below
commit 75bde1f646c22ae9d9ffe7b129577932a29fac41
Author: Dongjoon Hyun <[email protected]>
AuthorDate: Sun Jan 4 07:39:34 2026 +0900
ORC-2048: Use Java `InputStream.skipNBytes` instead of `IOUtils.skipFully`
### What changes were proposed in this pull request?
This PR aims to use Java `InputStream.skipNBytes` instead of
`IOUtils.skipFully`.
```scala
- IOUtils.skipFully(input, numSkipRows);
+ input.skipNBytes(numSkipRows);
```
### Why are the changes needed?
Java 12+ supports `skipNBytes` natively. We had better use this simple
style.
- [JDK-8214072: InputStream.skipNBytes(long k) to skip exactly k
bytes](https://bugs.openjdk.org/browse/JDK-8214072)
### Does this PR introduce _any_ user-facing change?
No.
### How was this patch tested?
Pass the CIs.
### Was this patch authored or co-authored using generative AI tooling?
No.
Closes #2471 from dongjoon-hyun/ORC-2048.
Authored-by: Dongjoon Hyun <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
---
java/core/src/java/org/apache/orc/impl/RunLengthByteReader.java | 4 ++--
java/core/src/java/org/apache/orc/impl/SerializationUtils.java | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/java/core/src/java/org/apache/orc/impl/RunLengthByteReader.java
b/java/core/src/java/org/apache/orc/impl/RunLengthByteReader.java
index b564db613..62da3221a 100644
--- a/java/core/src/java/org/apache/orc/impl/RunLengthByteReader.java
+++ b/java/core/src/java/org/apache/orc/impl/RunLengthByteReader.java
@@ -55,7 +55,7 @@ public class RunLengthByteReader {
repeat = true;
numLiterals = control + RunLengthByteWriter.MIN_REPEAT_SIZE;
if (numSkipRows >= numLiterals) {
- IOUtils.skipFully(input,1);
+ input.skipNBytes(1);
} else {
int val = input.read();
if (val == -1) {
@@ -68,7 +68,7 @@ public class RunLengthByteReader {
numLiterals = 0x100 - control;
numSkipRows = Math.min(numSkipRows, numLiterals);
if (numSkipRows > 0) {
- IOUtils.skipFully(input, numSkipRows);
+ input.skipNBytes(numSkipRows);
}
int bytes = numSkipRows;
while (bytes < numLiterals) {
diff --git a/java/core/src/java/org/apache/orc/impl/SerializationUtils.java
b/java/core/src/java/org/apache/orc/impl/SerializationUtils.java
index 1105a42cc..a5824aca6 100644
--- a/java/core/src/java/org/apache/orc/impl/SerializationUtils.java
+++ b/java/core/src/java/org/apache/orc/impl/SerializationUtils.java
@@ -108,7 +108,7 @@ public final class SerializationUtils {
}
public void skipFloat(InputStream in, int numOfFloats) throws IOException {
- IOUtils.skipFully(in, numOfFloats * 4L);
+ in.skipNBytes(numOfFloats * 4L);
}
public void writeFloat(OutputStream output,
@@ -154,7 +154,7 @@ public final class SerializationUtils {
}
public void skipDouble(InputStream in, int numOfDoubles) throws IOException {
- IOUtils.skipFully(in, numOfDoubles * 8L);
+ in.skipNBytes(numOfDoubles * 8L);
}
public void writeDouble(OutputStream output, double value)