@@ -29,6 +29,7 @@ public class ByteArrayInputStream extends InputStream {
29
29
private Integer peek ;
30
30
private Integer pos , markPosition ;
31
31
private int blockLength = -1 ;
32
+ private int initialBlockLength = -1 ;
32
33
33
34
public ByteArrayInputStream (InputStream inputStream ) {
34
35
this .inputStream = inputStream ;
@@ -110,7 +111,10 @@ public void fill(byte[] bytes, int offset, int length) throws IOException {
110
111
while (remaining != 0 ) {
111
112
int read = read (bytes , offset + length - remaining , remaining );
112
113
if (read == -1 ) {
113
- throw new EOFException ();
114
+ throw new EOFException (
115
+ String .format ("Failed to read remaining %d of %d bytes from position %d. Block length: %d. Initial block length: %d." ,
116
+ remaining , length , pos , blockLength , initialBlockLength )
117
+ );
114
118
}
115
119
remaining -= read ;
116
120
}
@@ -206,7 +210,7 @@ public int read() throws IOException {
206
210
peek = null ;
207
211
}
208
212
if (result == -1 ) {
209
- throw new EOFException ();
213
+ throw new EOFException (String . format ( "Failed to read next byte from position %d" , this . pos ) );
210
214
}
211
215
this .pos += 1 ;
212
216
return result ;
@@ -273,6 +277,7 @@ public void close() throws IOException {
273
277
274
278
public void enterBlock (int length ) {
275
279
this .blockLength = length < -1 ? -1 : length ;
280
+ this .initialBlockLength = length ;
276
281
}
277
282
278
283
public void skipToTheEndOfTheBlock () throws IOException {
0 commit comments