File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
src/main/java/org/scijava/io Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change 3333
3434import java .io .Closeable ;
3535import java .io .DataInput ;
36+ import java .io .DataInputStream ;
3637import java .io .DataOutput ;
3738import java .io .EOFException ;
3839import java .io .IOException ;
@@ -444,6 +445,20 @@ default void readFully(final byte[] b) throws IOException {
444445 readFully (b , 0 , b .length );
445446 }
446447
448+ @ Override
449+ default void readFully (final byte [] b , final int off , final int len )
450+ throws IOException
451+ {
452+ // NB: Adapted from java.io.DataInputStream.readFully(byte[], int, int).
453+ if (len < 0 ) throw new IndexOutOfBoundsException ();
454+ int n = 0 ;
455+ while (n < len ) {
456+ int count = read (b , off + n , len - n );
457+ if (count < 0 ) throw new EOFException ();
458+ n += count ;
459+ }
460+ }
461+
447462 @ Override
448463 default int skipBytes (final int n ) throws IOException {
449464 final int skip = (int ) Math .min (n , length () - offset ());
You can’t perform that action at this time.
0 commit comments