private PdfObject readCompressedStream(PdfObject rootObj,int pointer,final PdfFileReader currentPdfFile,final ObjectReader objectReader,final PdfObject linearObj) throws PdfException {
  while (pointer != -1) {
    movePointer(pointer);
    final byte[] raw=objectReader.readObjectData(-1,null);
    final StringBuilder objectName=new StringBuilder();
    char current1, last=' ';
    int matched=0, i1=0;
    while (i1 < raw.length) {
      current1=(char)raw[i1];
      if (current1 == 10 || current1 == 13) {
        current1=' ';
      }
      if (current1 == ' ' && last == ' ') {
        matched=0;
      }
 else       if (current1 == pattern.charAt(matched)) {
        matched++;
      }
 else {
        matched=0;
        objectName.append(current1);
      }
      if (matched == 3) {
        break;
      }
      last=current1;
      i1++;
    }
    objectName.append('R');
    final PdfObject pdfObject=new CompressedObject(objectName.toString());
    pdfObject.setCompressedStream(true);
    final ObjectDecoder objectDecoder=new ObjectDecoder(currentPdfFile);
    objectDecoder.readDictionaryAsObject(pdfObject,0,raw);
    final int[] fieldSizes=pdfObject.getIntArray(PdfDictionary.W);
    byte[] xrefs=pdfObject.getDecodedStream();
    if (xrefs == null) {
      xrefs=currentPdfFile.readStream(pdfObject,true,true,false,false,true,null);
    }
    final int[] Index=pdfObject.getIntArray(PdfDictionary.Index);
    if (Index == null) {
      CompressedObjects.readCompressedOffsets(0,0,pdfObject.getInt(PdfDictionary.Size),fieldSizes,xrefs,offset,pdf_datafile);
    }
 else {
      final int count=Index.length;
      int pntr=0;
      for (int aa=0; aa < count; aa+=2) {
        pntr=CompressedObjects.readCompressedOffsets(pntr,Index[aa],Index[aa + 1],fieldSizes,xrefs,offset,pdf_datafile);
      }
    }
    if (rootObj == null) {
      rootObj=pdfObject.getDictionary(PdfDictionary.Root);
      encryptObj=pdfObject.getDictionary(PdfDictionary.Encrypt);
      if (encryptObj != null) {
        final byte[][] IDs=pdfObject.getStringArray(PdfDictionary.ID);
        if (IDs != null && this.ID == null) {
          this.ID=IDs[0];
        }
      }
      infoObject=pdfObject.getDictionary(PdfDictionary.Info);
    }
    if (linearObj != null) {
      pointer=-1;
    }
 else {
      pointer=pdfObject.getInt(PdfDictionary.Prev);
      if (pointer != -1 && !isCompressedStream(pointer,(int)eof)) {
        return readLegacyReferenceTable(rootObj,pointer,(int)eof,currentPdfFile);
      }
    }
  }
  return rootObj;
}

private PdfObject readCompressedStream ( PdfObject rootObj , int pointer , final PdfFileReader currentPdfFile , final ObjectReader objectReader , final PdfObject linearObj ) throws PdfException { while ( pointer != - 1 ) { movePointer ( pointer ) ; final byte [ ] raw = objectReader . readObjectData ( - 1 , null ) ; final StringBuilder objectName = new StringBuilder ( ) ; char current1 , last = ' ' ; int matched = 0 , i1 = 0 ; while ( i1 < raw . length ) { current1 = ( char ) raw [ i1 ] ; if ( current1 == 10 || current1 == 13 ) { current1 = ' ' ; } if ( current1 == ' ' && last == ' ' ) { matched = 0 ; } else if ( current1 == pattern . charAt ( matched ) ) { matched ++ ; } else { matched = 0 ; objectName . append ( current1 ) ; } if ( matched == 3 ) { break ; } last = current1 ; i1 ++ ; } objectName . append ( 'R' ) ; final PdfObject pdfObject = new CompressedObject ( objectName . toString ( ) ) ; pdfObject . setCompressedStream ( true ) ; final ObjectDecoder objectDecoder = new ObjectDecoder ( currentPdfFile ) ; objectDecoder . readDictionaryAsObject ( pdfObject , 0 , raw ) ; final int [ ] fieldSizes = pdfObject . getIntArray ( PdfDictionary . W ) ; byte [ ] xrefs = pdfObject . getDecodedStream ( ) ; if ( xrefs == null ) { xrefs = currentPdfFile . readStream ( pdfObject , true , true , false , false , true , null ) ; } final int [ ] Index = pdfObject . getIntArray ( PdfDictionary . Index ) ; if ( Index == null ) { CompressedObjects . readCompressedOffsets ( 0 , 0 , pdfObject . getInt ( PdfDictionary . Size ) , fieldSizes , xrefs , offset , pdf_datafile ) ; } else { final int count = Index . length ; int pntr = 0 ; for ( int aa = 0 ; aa < count ; aa += 2 ) { pntr = CompressedObjects . readCompressedOffsets ( pntr , Index [ aa ] , Index [ aa + 1 ] , fieldSizes , xrefs , offset , pdf_datafile ) ; } } if ( rootObj == null ) { rootObj = pdfObject . getDictionary ( PdfDictionary . Root ) ; encryptObj = pdfObject . getDictionary ( PdfDictionary . Encrypt ) ; if ( encryptObj != null ) { final byte [ ] [ ] IDs = pdfObject . getStringArray ( PdfDictionary . ID ) ; if ( IDs != null && this . ID == null ) { this . ID = IDs [ 0 ] ; } } infoObject = pdfObject . getDictionary ( PdfDictionary . Info ) ; } if ( linearObj != null ) { pointer = - 1 ; } else { pointer = pdfObject . getInt ( PdfDictionary . Prev ) ; if ( pointer != - 1 && ! isCompressedStream ( pointer , ( int ) eof ) ) { return readLegacyReferenceTable ( rootObj , pointer , ( int ) eof , currentPdfFile ) ; } } } return rootObj ; }
read 1 . 5 compression stream ref table
