diff --git a/brotli4j/src/main/java/com/aayushatharva/brotli4j/encoder/EncoderJNI.java b/brotli4j/src/main/java/com/aayushatharva/brotli4j/encoder/EncoderJNI.java index e282a814..175e67df 100644 --- a/brotli4j/src/main/java/com/aayushatharva/brotli4j/encoder/EncoderJNI.java +++ b/brotli4j/src/main/java/com/aayushatharva/brotli4j/encoder/EncoderJNI.java @@ -14,7 +14,7 @@ * JNI wrapper for brotli encoder. */ @Upstream -class EncoderJNI { +public class EncoderJNI { private static native ByteBuffer nativeCreate(long[] context); private static native void nativePush(long[] context, int length); private static native ByteBuffer nativePull(long[] context); @@ -73,12 +73,12 @@ static PreparedDictionary prepareDictionary(ByteBuffer dictionary, int sharedDic return new PreparedDictionaryImpl(dictionaryData, dictionary); } - static class Wrapper { + public static class Wrapper { protected final long[] context = new long[5]; private final ByteBuffer inputBuffer; private boolean fresh = true; - Wrapper(int inputBufferSize, int quality, int lgwin, Encoder.Mode mode) + public Wrapper(int inputBufferSize, int quality, int lgwin, Encoder.Mode mode) throws IOException { if (inputBufferSize <= 0) { throw new IOException("buffer size must be positive"); @@ -97,7 +97,7 @@ static class Wrapper { this.context[4] = 0; } - boolean attachDictionary(ByteBuffer dictionary) { + public boolean attachDictionary(ByteBuffer dictionary) { if (!dictionary.isDirect()) { throw new IllegalArgumentException("only direct buffers allowed"); } @@ -110,7 +110,7 @@ boolean attachDictionary(ByteBuffer dictionary) { return nativeAttachDictionary(context, dictionary); } - void push(Operation op, int length) { + public void push(Operation op, int length) { if (length < 0) { throw new IllegalArgumentException("negative block length"); } @@ -128,27 +128,27 @@ void push(Operation op, int length) { nativePush(context, length); } - boolean isSuccess() { + public boolean isSuccess() { return context[1] != 0; } - boolean hasMoreOutput() { + public boolean hasMoreOutput() { return context[2] != 0; } - boolean hasRemainingInput() { + public boolean hasRemainingInput() { return context[3] != 0; } - boolean isFinished() { + public boolean isFinished() { return context[4] != 0; } - ByteBuffer getInputBuffer() { + public ByteBuffer getInputBuffer() { return inputBuffer; } - ByteBuffer pull() { + public ByteBuffer pull() { if (context[0] == 0) { throw new IllegalStateException("brotli encoder is already destroyed"); } @@ -162,7 +162,7 @@ ByteBuffer pull() { /** * Releases native resources. */ - void destroy() { + public void destroy() { if (context[0] == 0) { throw new IllegalStateException("brotli encoder is already destroyed"); }