aboutsummaryrefslogtreecommitdiff
path: root/java/org/brotli/wrapper/dec
diff options
context:
space:
mode:
Diffstat (limited to 'java/org/brotli/wrapper/dec')
-rw-r--r--java/org/brotli/wrapper/dec/BUILD6
-rw-r--r--java/org/brotli/wrapper/dec/BrotliInputStream.java4
-rw-r--r--java/org/brotli/wrapper/dec/Decoder.java4
-rw-r--r--java/org/brotli/wrapper/dec/DecoderJNI.java3
-rwxr-xr-xjava/org/brotli/wrapper/dec/EagerStreamTest.java2
5 files changed, 11 insertions, 8 deletions
diff --git a/java/org/brotli/wrapper/dec/BUILD b/java/org/brotli/wrapper/dec/BUILD
index fcf0dbf..754541a 100644
--- a/java/org/brotli/wrapper/dec/BUILD
+++ b/java/org/brotli/wrapper/dec/BUILD
@@ -39,7 +39,6 @@ filegroup(
java_test(
name = "BrotliDecoderChannelTest",
- test_class = "org.brotli.wrapper.dec.BrotliDecoderChannelTest",
size = "large",
data = [
":brotli_jni", # Bazel JNI workaround
@@ -49,12 +48,12 @@ java_test(
"-DBROTLI_JNI_LIBRARY=$(location :brotli_jni)",
"-DTEST_BUNDLE=$(location :test_bundle)",
],
+ test_class = "org.brotli.wrapper.dec.BrotliDecoderChannelTest",
runtime_deps = [":test_lib"],
)
java_test(
name = "BrotliInputStreamTest",
- test_class = "org.brotli.wrapper.dec.BrotliInputStreamTest",
size = "large",
data = [
":brotli_jni", # Bazel JNI workaround
@@ -64,12 +63,12 @@ java_test(
"-DBROTLI_JNI_LIBRARY=$(location :brotli_jni)",
"-DTEST_BUNDLE=$(location :test_bundle)",
],
+ test_class = "org.brotli.wrapper.dec.BrotliInputStreamTest",
runtime_deps = [":test_lib"],
)
java_test(
name = "DecoderTest",
- test_class = "org.brotli.wrapper.dec.DecoderTest",
size = "large",
data = [
":brotli_jni", # Bazel JNI workaround
@@ -79,5 +78,6 @@ java_test(
"-DBROTLI_JNI_LIBRARY=$(location :brotli_jni)",
"-DTEST_BUNDLE=$(location :test_bundle)",
],
+ test_class = "org.brotli.wrapper.dec.DecoderTest",
runtime_deps = [":test_lib"],
)
diff --git a/java/org/brotli/wrapper/dec/BrotliInputStream.java b/java/org/brotli/wrapper/dec/BrotliInputStream.java
index 26f7a82..6e2e6e5 100644
--- a/java/org/brotli/wrapper/dec/BrotliInputStream.java
+++ b/java/org/brotli/wrapper/dec/BrotliInputStream.java
@@ -34,8 +34,8 @@ public class BrotliInputStream extends InputStream {
this(source, DEFAULT_BUFFER_SIZE);
}
- public void setEager(boolean eager) {
- decoder.setEager(eager);
+ public void enableEagerOutput() {
+ decoder.enableEagerOutput();
}
@Override
diff --git a/java/org/brotli/wrapper/dec/Decoder.java b/java/org/brotli/wrapper/dec/Decoder.java
index ae4d817..26183ab 100644
--- a/java/org/brotli/wrapper/dec/Decoder.java
+++ b/java/org/brotli/wrapper/dec/Decoder.java
@@ -50,8 +50,8 @@ public class Decoder {
throw new IOException(message);
}
- public void setEager(boolean eager) {
- this.eager = eager;
+ public void enableEagerOutput() {
+ this.eager = true;
}
/**
diff --git a/java/org/brotli/wrapper/dec/DecoderJNI.java b/java/org/brotli/wrapper/dec/DecoderJNI.java
index 320705c..2319b1e 100644
--- a/java/org/brotli/wrapper/dec/DecoderJNI.java
+++ b/java/org/brotli/wrapper/dec/DecoderJNI.java
@@ -30,6 +30,7 @@ public class DecoderJNI {
private final long[] context = new long[3];
private final ByteBuffer inputBuffer;
private Status lastStatus = Status.NEEDS_MORE_INPUT;
+ private boolean fresh = true;
public Wrapper(int inputBufferSize) throws IOException {
this.context[1] = inputBufferSize;
@@ -52,6 +53,7 @@ public class DecoderJNI {
if (lastStatus == Status.OK && length != 0) {
throw new IllegalStateException("pushing input to decoder in OK state");
}
+ fresh = false;
nativePush(context, length);
parseStatus();
}
@@ -90,6 +92,7 @@ public class DecoderJNI {
if (lastStatus != Status.NEEDS_MORE_OUTPUT && !hasOutput()) {
throw new IllegalStateException("pulling output from decoder in " + lastStatus + " state");
}
+ fresh = false;
ByteBuffer result = nativePull(context);
parseStatus();
return result;
diff --git a/java/org/brotli/wrapper/dec/EagerStreamTest.java b/java/org/brotli/wrapper/dec/EagerStreamTest.java
index 9166092..919f6e3 100755
--- a/java/org/brotli/wrapper/dec/EagerStreamTest.java
+++ b/java/org/brotli/wrapper/dec/EagerStreamTest.java
@@ -56,7 +56,7 @@ public class EagerStreamTest extends BrotliJniTestBase {
}
};
BrotliInputStream reader = new BrotliInputStream(source);
- reader.setEager(true);
+ reader.enableEagerOutput();
int count = 0;
while (true) {
log.append("^").append(count);