code: public Frame readNextFrame() throws IOException {
          //boolean got_a_frame;
          
          try {
              while (true) {
                  //switch (state) {
                  //case STREAM_DECODER_SEARCH_FOR_METADATA :
                  //    findMetadata();
                  //    break;
                  //case STREAM_DECODER_READ_METADATA :
                  //    readMetadata(); /* above function sets the status for us */
                  //    break;
                  //case DECODER_SEARCH_FOR_FRAME_SYNC :
                  findFrameSync(); /* above function sets the status for us */
                  //System.exit(0);
                  //break;
                  //case DECODER_READ_FRAME :
                  try {
                      readFrame();
                      return frame;
                  } catch (FrameDecodeException e) {
                      badFrames++;
                  }
                  //break;
                  //case DECODER_END_OF_STREAM :
                  //case DECODER_ABORTED :
                  //    return null;
                  //default :
                  //    return null;
                  //}
              }
          } catch (EOFException e) {
              eof = true;
          }
          return null;
      }
docs: Read the next data frame.
  @return  The next frame
  @throws IOException  on read error