/** * Skips n bytes from the stream. If the end of * the stream has been reached before reading n bytes * then it returns. * <B>NB:</B> This method uses read() internally. * @param n long the number of characters to skip. * @return long the number of characters skipped. * @throws IOException if there is any error while * reading from the stream. */ public long skip(long n) throws IOException { /* TODO a more efficient implementation could be made */ long i = 0; for (; i < n && size < maxsize; i++) { this.read(); } return i; }
/** * Skips n bytes from the stream. If the end of * the stream has been reached before reading n bytes * then it returns. * <B>NB:</B> This method uses read() internally. * @param n long the number of characters to skip. * @return long the number of characters skipped. * @throws IOException if there is any error while * reading from the stream. */ public long skip(long n) throws IOException { /* TODO a more efficient implementation could be made */ long i = 0; for (; i < n && size < maxsize; i++) { this.read(); } return i; }