Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
deshanxiao committed Jan 1, 2024
1 parent dfafb9d commit e725e7e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 12 deletions.
13 changes: 2 additions & 11 deletions java/core/src/java/org/apache/orc/impl/BrotliCodec.java
Original file line number Diff line number Diff line change
Expand Up @@ -114,17 +114,8 @@ public boolean compress(
Options options) throws IOException {
BrotliOptions brotliOptions = (BrotliOptions) options;
int inBytes = in.remaining();
// TODO Make EncoderJNI and EncoderJNI.Wrapper public and then we can avoid data copy. See:https://github.com/hyperxpro/Brotli4j/issues/123
byte[] compressed = null;
if (in.arrayOffset() + in.position() == 0) {
compressed = Encoder.compress(
in.array(), in.arrayOffset() + in.position(), inBytes, brotliOptions.brotli4jParameter());
} else {
byte[] input = new byte[in.remaining()];
ByteBuffer slice = in.slice();
slice.get(0, input);
compressed = Encoder.compress(input, 0, inBytes, brotliOptions.brotli4jParameter());
}
byte[] compressed = Encoder.compress(
in.array(), in.arrayOffset() + in.position(), inBytes, brotliOptions.brotli4jParameter());
int outBytes = compressed.length;
if (outBytes < inBytes) {
int remaining = out.remaining();
Expand Down
2 changes: 1 addition & 1 deletion java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
</modules>

<properties>
<brotli4j.version>1.14.0</brotli4j.version>
<brotli4j.version>1.15.0</brotli4j.version>
<checkstyle.version>10.12.0</checkstyle.version>
<example.dir>${project.basedir}/../../examples</example.dir>
<hadoop.version>3.3.6</hadoop.version>
Expand Down

0 comments on commit e725e7e

Please sign in to comment.