private synchronized int readRecordLength() throws IOException {
  if (in.getPos() >= end) {
    return -1;
  }
  int length=in.readInt();
  if (sync != null && length == SYNC_ESCAPE) {
    in.readFully(syncCheck);
    if (!Arrays.equals(sync,syncCheck)) {
      throw new IOException("File is corrupt!");
    }
    syncSeen=true;
    if (in.getPos() >= end) {
      return -1;
    }
    length=in.readInt();
  }
 else {
    syncSeen=false;
  }
  return length;
}

private synchronized int readRecordLength ( ) throws IOException { if ( in . getPos ( ) >= end ) { return - 1 ; } int length = in . readInt ( ) ; if ( sync != null && length == SYNC_ESCAPE ) { in . readFully ( syncCheck ) ; if ( ! Arrays . equals ( sync , syncCheck ) ) { throw new IOException ( "File is corrupt!" ) ; } syncSeen = true ; if ( in . getPos ( ) >= end ) { return - 1 ; } length = in . readInt ( ) ; } else { syncSeen = false ; } return length ; }
read and return the next record length , potentially skipping over a sync block .
