[FIX] Исправление сжатия JAR

This commit is contained in:
Gravit 2019-07-16 02:54:38 +07:00
parent 9da5191738
commit 189f63efc3
No known key found for this signature in database
GPG key ID: 061981E1E85D3216

View file

@ -6,6 +6,7 @@
import java.io.IOException; import java.io.IOException;
import java.nio.file.Path; import java.nio.file.Path;
import java.util.zip.Deflater; import java.util.zip.Deflater;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream; import java.util.zip.ZipInputStream;
import java.util.zip.ZipOutputStream; import java.util.zip.ZipOutputStream;
@ -28,9 +29,18 @@ public Path process(Path inputFile) throws IOException {
{ {
outputStream.setMethod(ZipOutputStream.DEFLATED); outputStream.setMethod(ZipOutputStream.DEFLATED);
outputStream.setLevel(Deflater.BEST_COMPRESSION); outputStream.setLevel(Deflater.BEST_COMPRESSION);
try(ZipInputStream inputStream = IOHelper.newZipInput(inputFile)) try(ZipInputStream input = IOHelper.newZipInput(inputFile))
{ {
ZipEntry e = input.getNextEntry();
while (e != null) {
if (e.isDirectory()) {
e = input.getNextEntry();
continue;
}
outputStream.putNextEntry(IOHelper.newZipEntry(e));
IOHelper.transfer(input, outputStream);
e = input.getNextEntry();
}
} }
} }
return output; return output;