Skip to content

Commit

Permalink
Using released Brotli4j 1.17.0
Browse files Browse the repository at this point in the history
  • Loading branch information
joakime committed Aug 21, 2024
1 parent 5ba1c5d commit 00b2992
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<dependency>
<groupId>com.aayushatharva.brotli4j</groupId>
<artifactId>brotli4j</artifactId>
<version>1.16.0</version>
<version>1.17.0</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

import com.aayushatharva.brotli4j.encoder.Encoder;
import com.aayushatharva.brotli4j.encoder.EncoderJNI;
import com.aayushatharva.brotli4j.encoder.EncoderJNIOp;
import org.eclipse.jetty.compression.EncoderSink;
import org.eclipse.jetty.io.Content;
import org.eclipse.jetty.util.BufferUtil;
Expand Down Expand Up @@ -107,7 +106,7 @@ protected WriteRecord encode(boolean last, ByteBuffer content)
// only encode if inputBuffer is full.
if (!inputBuffer.hasRemaining())
{
ByteBuffer output = encode(EncoderJNIOp.PROCESS);
ByteBuffer output = encode(EncoderJNI.Operation.PROCESS);
if (output != null)
return new WriteRecord(false, output, Callback.NOOP);
}
Expand All @@ -129,15 +128,15 @@ protected WriteRecord encode(boolean last, ByteBuffer content)
case FLUSHING ->
{
inputBuffer.limit(inputBuffer.position());
ByteBuffer output = encode(EncoderJNIOp.FLUSH);
ByteBuffer output = encode(EncoderJNI.Operation.FLUSH);
state.compareAndSet(State.FLUSHING, State.FINISHING);
if (output != null)
return new WriteRecord(false, output, Callback.NOOP);
}
case FINISHING ->
{
inputBuffer.limit(inputBuffer.position());
ByteBuffer output = encode(EncoderJNIOp.FINISH);
ByteBuffer output = encode(EncoderJNI.Operation.FINISH);
state.compareAndSet(State.FINISHING, State.FINISHED);
return new WriteRecord(true, output != null ? output : EMPTY_BUFFER, Callback.NOOP);
}
Expand All @@ -149,7 +148,7 @@ protected WriteRecord encode(boolean last, ByteBuffer content)
}
}

protected ByteBuffer encode(EncoderJNIOp op)
protected ByteBuffer encode(EncoderJNI.Operation op)
{
try
{
Expand All @@ -168,11 +167,11 @@ else if (encoder.hasMoreOutput())
}
else if (encoder.hasRemainingInput())
{
encoder.push(op.getOp(), 0);
encoder.push(op, 0);
}
else if (!inputPushed)
{
encoder.push(op.getOp(), inputBuffer.limit());
encoder.push(op, inputBuffer.limit());
inputPushed = true;
}
else
Expand Down

0 comments on commit 00b2992

Please sign in to comment.