@ Override public int read ( byte [ ] b , int off , int len ) throws IOException { if ( currentEntry != null ) { if ( currentFileSize == currentEntry . getSize ( ) ) { return - 1 ; } else if ( ( currentEntry . getSize ( ) - currentFileSize ) < len ) { len = ( int ) ( currentEntry . getSize ( ) - currentFileSize ) ; } } int br = super . read ( b , off , len ) ; if ( br != - 1 ) { if ( currentEntry != null ) { currentFileSize += br ; } bytesRead += br ; } return br ; }
Checks if the bytes being read exceed the entry size and adjusts the byte array length . Updates the byte counters