private boolean ensureDataInBuffer ( ) throws IOException { if ( mBufferOffset < mBufferedSize ) { return true ; } final int readData = mInputStream . read ( mByteArray ) ; if ( readData <= 0 ) { return false ; } mBufferedSize = readData ; mBufferOffset = 0 ; return true ; }
Checks if there is some data left in the buffer . If not but buffered stream still has some data to be read then more data is buffered .