Skip to content

Commit

Permalink
lz4-pure-java
Browse files Browse the repository at this point in the history
  • Loading branch information
laullon committed Sep 14, 2023
1 parent 5e80b0c commit bee889f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
12 changes: 6 additions & 6 deletions proxy/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -533,12 +533,12 @@
<version>1.3.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>net.jpountz.lz4</groupId>
<artifactId>lz4</artifactId>
<version>1.3.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.lz4</groupId>
<artifactId>lz4-pure-java</artifactId>
<version>1.8.0</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.lmax</groupId>
<artifactId>disruptor</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
import java.util.zip.GZIPOutputStream;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import net.jpountz.lz4.LZ4BlockInputStream;
import net.jpountz.lz4.LZ4BlockOutputStream;
import org.apache.commons.compress.compressors.lz4.FramedLZ4CompressorInputStream;
import org.apache.commons.compress.compressors.lz4.FramedLZ4CompressorOutputStream;
import org.apache.commons.io.IOUtils;

/**
Expand Down Expand Up @@ -72,7 +72,7 @@ public T fromBytes(@Nonnull byte[] bytes) {
try {
switch (compression) {
case FORMAT_LZ4:
stream = new LZ4BlockInputStream(input);
stream = new FramedLZ4CompressorInputStream(input);
break;
case FORMAT_GZIP:
stream = new GZIPInputStream(input);
Expand Down Expand Up @@ -116,7 +116,8 @@ public void serializeToStream(@Nonnull T t, @Nonnull OutputStream bytes) throws
case LZ4:
bytes.write(FORMAT_LZ4);
bytes.write(ByteBuffer.allocate(4).putInt(t.weight()).array());
LZ4BlockOutputStream lz4BlockOutputStream = new LZ4BlockOutputStream(bytes);
FramedLZ4CompressorOutputStream lz4BlockOutputStream =
new FramedLZ4CompressorOutputStream(bytes);
objectMapper.writeValue(lz4BlockOutputStream, t);
lz4BlockOutputStream.close();
return;
Expand Down

0 comments on commit bee889f

Please sign in to comment.