MpegStream extends PushbackInputStream { public AudioFrame nextFrame() throws IOException { AudioFrame frame = null; while (!endOfStream && frame == null) { findFrameSyncByte(); if (!endOfStream) { HeaderBitField headerField = createHeaderField(); if (!endOfStream) { frame = createHeader(headerField); if (frame == null) { pushBack(headerField); } } } } currentHeader = frame; return frame; } MpegStream(InputStream in); AudioFrame nextFrame(); boolean skipFrame();  }
@Test public void testSeachNextFrameEOS() throws IOException { ByteArrayOutputStream bos = new ByteArrayOutputStream(); bos.write(0xFF); bos.write(0xFF); bos.write(0xF3); bos.write(0x96); ByteArrayInputStream in = new ByteArrayInputStream(bos.toByteArray()); stream = new MpegStream(in); assertNull("Got a frame", stream.nextFrame()); }