question: protected int read ( InputStream inputStream , byte [ ] buffer , char divider ) throws IOException { int index = 0 ; do { byte readByte = ( byte ) ( 0x000000FF & inputStream . read ( ) ) ; if ( readByte == - 1 || readByte == ( byte ) divider ) { return index ; } buffer [ index ] = readByte ; index ++ ; } while ( index < buffer . length ) ; return index ; }
target:  Reads bytes from a given file reader until either a certain character is read, the buffer is completely filled or the end of file is reached.