public final PdfObject readReferenceTable(final PdfObject linearObj,final PdfFileReader currentPdfFile,final ObjectReader objectReader) throws PdfException {
  int pointer=-1;
  final int eof=(int)this.eof;
  boolean islinearizedCompressed=false;
  if (linearObj == null) {
    pointer=readFirstStartRef();
  }
 else {
    final byte[] data=pdf_datafile.getPdfBuffer();
    final int count=data.length;
    int ptr=5;
    for (int i=0; i < count; i++) {
      if (data[i] == 'e' && data[i + 1] == 'n' && data[i + 2] == 'd' && data[i + 3] == 'o' && data[i + 4] == 'b' && data[i + 5] == 'j') {
        ptr=i + 6;
      }
      if (data[i] == 'x' && data[i + 1] == 'r' && data[i + 2] == 'e' && data[i + 3] == 'f') {
        pointer=i;
        i=count;
      }
 else       if (data[i] == 'X' && data[i + 1] == 'R' && data[i + 2] == 'e' && data[i + 3] == 'f') {
        islinearizedCompressed=true;
        pointer=ptr;
        while (data[pointer] == 10 || data[pointer] == 13 || data[pointer] == 32) {
          pointer++;
        }
        i=count;
      }
    }
  }
  offset.addXref(pointer);
  PdfObject rootObj=null;
  if (pointer >= eof || pointer == 0) {
    LogWriter.writeLog("Pointer not if file - trying to manually find startref");
    offset.setRefTableInvalid(true);
    try {
      rootObj=new PageObject(BrokenRefTable.findOffsets(pdf_datafile,offset));
    }
 catch (    Error err) {
      throw new PdfException(err.getMessage() + " attempting to manually scan file for objects");
    }
    currentPdfFile.readObject(rootObj);
    return rootObj;
  }
 else   if (islinearizedCompressed || isCompressedStream(pointer,eof)) {
    return readCompressedStream(rootObj,pointer,currentPdfFile,objectReader,linearObj);
  }
 else {
    return readLegacyReferenceTable(rootObj,pointer,eof,currentPdfFile);
  }
}

public final PdfObject readReferenceTable ( final PdfObject linearObj , final PdfFileReader currentPdfFile , final ObjectReader objectReader ) throws PdfException { int pointer = - 1 ; final int eof = ( int ) this . eof ; boolean islinearizedCompressed = false ; if ( linearObj == null ) { pointer = readFirstStartRef ( ) ; } else { final byte [ ] data = pdf_datafile . getPdfBuffer ( ) ; final int count = data . length ; int ptr = 5 ; for ( int i = 0 ; i < count ; i ++ ) { if ( data [ i ] == 'e' && data [ i + 1 ] == 'n' && data [ i + 2 ] == 'd' && data [ i + 3 ] == 'o' && data [ i + 4 ] == 'b' && data [ i + 5 ] == 'j' ) { ptr = i + 6 ; } if ( data [ i ] == 'x' && data [ i + 1 ] == 'r' && data [ i + 2 ] == 'e' && data [ i + 3 ] == 'f' ) { pointer = i ; i = count ; } else if ( data [ i ] == 'X' && data [ i + 1 ] == 'R' && data [ i + 2 ] == 'e' && data [ i + 3 ] == 'f' ) { islinearizedCompressed = true ; pointer = ptr ; while ( data [ pointer ] == 10 || data [ pointer ] == 13 || data [ pointer ] == 32 ) { pointer ++ ; } i = count ; } } } offset . addXref ( pointer ) ; PdfObject rootObj = null ; if ( pointer >= eof || pointer == 0 ) { LogWriter . writeLog ( "Pointer not if file - trying to manually find startref" ) ; offset . setRefTableInvalid ( true ) ; try { rootObj = new PageObject ( BrokenRefTable . findOffsets ( pdf_datafile , offset ) ) ; } catch ( Error err ) { throw new PdfException ( err . getMessage ( ) + " attempting to manually scan file for objects" ) ; } currentPdfFile . readObject ( rootObj ) ; return rootObj ; } else if ( islinearizedCompressed || isCompressedStream ( pointer , eof ) ) { return readCompressedStream ( rootObj , pointer , currentPdfFile , objectReader , linearObj ) ; } else { return readLegacyReferenceTable ( rootObj , pointer , eof , currentPdfFile ) ; } }
read reference table start to see if new 1 . 5 type or traditional xref
