Skip to content
Permalink
Browse files
[COMPRESS-598] Refactor commons code.
  • Loading branch information
garydgregory committed Mar 18, 2022
1 parent 8b54008 commit 88cb3fb8d3908a6c35ad75e1ba2a8cd1a4be98d5
Showing 1 changed file with 7 additions and 12 deletions.
@@ -550,22 +550,17 @@ public int read(final byte[] buffer, final int offset, final int length) throws
@SuppressWarnings("resource") // checkInputStream() does not allocate.
@Override
public long getCompressedCount() {
if (current.entry.getMethod() == ZipArchiveOutputStream.STORED) {
final int method = current.entry.getMethod();
if (method == ZipArchiveOutputStream.STORED) {
return current.bytesRead;
}
if (current.entry.getMethod() == ZipArchiveOutputStream.DEFLATED) {
if (method == ZipArchiveOutputStream.DEFLATED) {
return getBytesInflated();
}
if (current.entry.getMethod() == ZipMethod.UNSHRINKING.getCode()) {
return ((InputStreamStatistics) current.checkInputStream()).getCompressedCount();
}
if (current.entry.getMethod() == ZipMethod.IMPLODING.getCode()) {
return ((InputStreamStatistics) current.checkInputStream()).getCompressedCount();
}
if (current.entry.getMethod() == ZipMethod.ENHANCED_DEFLATED.getCode()) {
return ((InputStreamStatistics) current.checkInputStream()).getCompressedCount();
}
if (current.entry.getMethod() == ZipMethod.BZIP2.getCode()) {
if (method == ZipMethod.UNSHRINKING.getCode()
|| method == ZipMethod.IMPLODING.getCode()
|| method == ZipMethod.ENHANCED_DEFLATED.getCode()
|| method == ZipMethod.BZIP2.getCode()) {
return ((InputStreamStatistics) current.checkInputStream()).getCompressedCount();
}
return -1;

0 comments on commit 88cb3fb

Please sign in to comment.