void prefetch_all_headers(Info first_i, Comment first_c, int dataoffset)
      throws JOrbisException{
    Page og=new Page();
    int ret;

    vi=new Info[links];
    vc=new Comment[links];
    dataoffsets=new long[links];
    pcmlengths=new long[links];
    serialnos=new int[links];

    for(int i=0; i<links; i++){
      if(first_i!=null&&first_c!=null&&i==0){
        // we already grabbed the initial header earlier.  This just
        // saves the waste of grabbing it again
        vi[i]=first_i;
        vc[i]=first_c;
        dataoffsets[i]=dataoffset;
      }
      else{
        // seek to the location of the initial header
        seek_helper(offsets[i]); //!!!
        vi[i]=new Info();
        vc[i]=new Comment();
        if(fetch_headers(vi[i], vc[i], null, null)==-1){
          dataoffsets[i]=-1;
        }
        else{
          dataoffsets[i]=offset;
          os.clear();
        }
      }

      // get the serial number and PCM length of this link. To do this,
      // get the last page of the stream
      {
        long end=offsets[i+1]; //!!!
        seek_helper(end);

        while(true){
          ret=get_prev_page(og);
          if(ret==-1){
            // this should not be possible
            vi[i].clear();
            vc[i].clear();
            break;
          }
          if(og.granulepos()!=-1){
            serialnos[i]=og.serialno();
            pcmlengths[i]=og.granulepos();
            break;
          }
        }
      }
    }
  }