int ch = read(); if ( ch == -1 )
/** * Skips characters. This method will block until some characters are available, an I/O error occurs, or the end of * the stream is reached. * * @param n The number of characters to skip * @return the number of characters actually skipped * @throws IOException If an I/O error occurs */ public long skip( long n ) throws IOException { if ( n < 0L ) { throw new IllegalArgumentException( "skip value is negative" ); } for ( long i = 0; i < n; i++ ) { if ( read() == -1 ) { return i; } } return n; }