Code example for EOFException

0
     * @throws EOFException for the end of source stream. 
     */ 
    private void fillBuf() throws IOException { 
        int result = in.read(buf, 0, buf.length);
        if (result == -1) {
            throw new EOFException();
        } 
        pos = 0;
        end = result;
    } 
}