public int read ( ) throws IOException { // If the file position is within the data, return the byte... if ( filePosition < dataEnd ) { int pos = ( int ) ( filePosition - bufferStart ) ; filePosition ++ ; return ( buffer [ pos ] & 0xff ) ; // ...or should we indicate EOF... } else if ( endOfFile ) { return - 1 ; // ...or seek to fill the buffer, and try again. } else { seek ( filePosition ) ; return read ( ) ; } }
Read a byte of data from the file blocking until data is available .