MpegStream extends PushbackInputStream { public boolean skipFrame() throws IOException { if (currentHeader != null) { long toSkip = currentHeader.getLength() - HEADER_SIZE; long skipped = IOUtils.skip(in, toSkip); currentHeader = null; if (skipped < toSkip) { return false; } return true; } return false; } MpegStream(InputStream in); AudioFrame nextFrame(); boolean skipFrame();  }
@Test public void testSkipNoCurrentHeader() throws IOException { ByteArrayOutputStream bos = new ByteArrayOutputStream(); bos.write("This is a test".getBytes(UTF_8)); ByteArrayInputStream in = new ByteArrayInputStream(bos.toByteArray()); stream = new MpegStream(in); assertFalse("Wrong result", stream.skipFrame()); }