This commit is contained in:
Jesse Boyd 2017-04-23 22:00:43 +10:00
parent a78a5e20ec
commit 403425d307
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F

View File

@ -66,11 +66,11 @@ import java.util.zip.Inflater;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import net.jpountz.lz4.LZ4BlockInputStream;
import net.jpountz.lz4.LZ4BlockOutputStream;
import net.jpountz.lz4.LZ4Compressor;
import net.jpountz.lz4.LZ4Factory;
import net.jpountz.lz4.LZ4FastDecompressor;
import net.jpountz.lz4.LZ4InputStream;
import net.jpountz.lz4.LZ4OutputStream;
import net.jpountz.lz4.LZ4Utils;
public class MainUtil {
@ -312,7 +312,8 @@ public class MainUtil {
}
public static FaweOutputStream getCompressedOS(OutputStream os, int amount, int buffer) throws IOException {
os.write((byte) 9 + amount);
// os.write((byte) 10 + amount);
os.write((byte) -amount);
os = new BufferedOutputStream(os, buffer);
if (amount == 0) {
return new FaweOutputStream(os);
@ -325,14 +326,14 @@ public class MainUtil {
LZ4Factory factory = LZ4Factory.fastestInstance();
int fastAmount = 1 + ((amount - 1) % 3);
for (int i = 0; i < fastAmount; i++) {
os = new LZ4BlockOutputStream(os, buffer, factory.fastCompressor());
os = new LZ4OutputStream(os, buffer, factory.fastCompressor());
}
int highAmount = amount > 3 ? 1 : 0;
for (int i = 0; i < highAmount; i++) {
if (amount == 9) {
os = new LZ4BlockOutputStream(os, buffer, factory.highCompressor(17));
os = new LZ4OutputStream(os, buffer, factory.highCompressor(17));
} else {
os = new LZ4BlockOutputStream(os, buffer, factory.highCompressor());
os = new LZ4OutputStream(os, buffer, factory.highCompressor());
}
}
return new FaweOutputStream(os);
@ -349,7 +350,7 @@ public class MainUtil {
return new FaweInputStream(is);
}
boolean legacy;
if (mode > 9) {
if (mode > 10) {
legacy = false;
mode = -mode + 9;
} else {