Invoke Inflater.end() in ZipInflaterInputStream.close()

Closes gh-14001
pull/14002/merge
Johnny Lim 6 years ago committed by Stephane Nicoll
parent b6dddcced8
commit af2db82b22

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2014 the original author or authors. * Copyright 2012-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -30,12 +30,19 @@ import java.util.zip.InflaterInputStream;
*/ */
class ZipInflaterInputStream extends InflaterInputStream { class ZipInflaterInputStream extends InflaterInputStream {
private final Inflater inflater;
private boolean extraBytesWritten; private boolean extraBytesWritten;
private int available; private int available;
ZipInflaterInputStream(InputStream inputStream, int size) { ZipInflaterInputStream(InputStream inputStream, int size) {
super(inputStream, new Inflater(true), getInflaterBufferSize(size)); this(inputStream, new Inflater(true), size);
}
private ZipInflaterInputStream(InputStream inputStream, Inflater inflater, int size) {
super(inputStream, inflater, getInflaterBufferSize(size));
this.inflater = inflater;
this.available = size; this.available = size;
} }
@ -56,6 +63,12 @@ class ZipInflaterInputStream extends InflaterInputStream {
return result; return result;
} }
@Override
public void close() throws IOException {
super.close();
this.inflater.end();
}
@Override @Override
protected void fill() throws IOException { protected void fill() throws IOException {
try { try {

Loading…
Cancel
Save