List of usage examples for org.apache.poi.util IOUtils skipFully
public static long skipFully(final InputStream input, final long toSkip) throws IOException
From source file:org.apache.tika.parser.mp3.MpegStream.java
License:Apache License
/** * Skips the current MPEG frame. This method can be called after a valid * MPEG header has been retrieved using {@code nextFrame()}. In this case * the underlying stream is advanced to the end of the associated MPEG * frame. Otherwise, this method has no effect. The return value indicates * whether a frame could be skipped./* ww w .ja v a 2 s . co m*/ * * @return <b>true</b> if a frame could be skipped, <b>false</b> otherwise * @throws IOException if an IO error occurs */ public boolean skipFrame() throws IOException { if (currentHeader != null) { long toSkip = currentHeader.getLength() - HEADER_SIZE; long skipped = IOUtils.skipFully(in, toSkip); if (skipped < toSkip) { throw new EOFException("EOF: tried to skip " + toSkip + " but could only skip " + skipped); } currentHeader = null; return true; } return false; }