File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -90,6 +90,9 @@ public LZ4BlockInputStream(InputStream in) {
9090
9191 @ Override
9292 public int available () throws IOException {
93+ if (o == originalLen ) {
94+ refill ();
95+ }
9396 return originalLen - o ;
9497 }
9598
@@ -147,7 +150,12 @@ public long skip(long n) throws IOException {
147150 }
148151
149152 private void refill () throws IOException {
150- readFully (compressedBuffer , HEADER_LENGTH );
153+ try {
154+ readFully (compressedBuffer , HEADER_LENGTH );
155+ } catch (EOFException e ) {
156+ finished = true ;
157+ return ;
158+ }
151159 for (int i = 0 ; i < MAGIC_LENGTH ; ++i ) {
152160 if (compressedBuffer [i ] != MAGIC [i ]) {
153161 throw new IOException ("Stream is corrupted" );
@@ -175,7 +183,7 @@ private void refill() throws IOException {
175183 if (check != 0 ) {
176184 throw new IOException ("Stream is corrupted" );
177185 }
178- finished = true ;
186+ refill () ;
179187 return ;
180188 }
181189 if (buffer .length < originalLen ) {
You can’t perform that action at this time.
0 commit comments