Package Common

Examples of Common.LongVector


                    this.ArchiveInfo.StartPositionAfterHeader, 1));
            this.ArchiveInfo.DataStartPosition2 += this.ArchiveInfo.StartPositionAfterHeader;
            type = this.inStream.ReadID();
        }
       
        LongVector unPackSizes = new LongVector();
        BoolVector digestsDefined = new BoolVector();
        IntVector digests = new IntVector();
       
        if (type == Header.NID.kMainStreamsInfo) {
            type = this.inStream.ReadID();
            assert (type == Header.NID.kPackInfo);
            this.ReadPackInfo(this.PackSizes, this.PackCRCsDefined, this.PackCRCs, 0);
           
            type = this.inStream.ReadID();
            assert (type == Header.NID.kUnPackInfo);
            this.Folders = ReadUnPackInfo(dataVector);
           
            type = this.inStream.ReadID();
            assert (type == Header.NID.kSubStreamsInfo);
            this.ReadSubStreamsInfo(this.Folders, this.NumUnPackStreamsVector, unPackSizes, digestsDefined, digests);
           
            type = this.inStream.ReadID();
            assert (type == Header.NID.kEnd);
           
            this.ArchiveInfo.DataStartPosition += this.ArchiveInfo.StartPositionAfterHeader;
            type = this.inStream.ReadID();
        } else {
            for(int i = 0; i < this.Folders.size(); i++) {
                this.NumUnPackStreamsVector.add(1);
                Folder folder = (Folder)this.Folders.get(i);
                unPackSizes.add(folder.GetUnPackSize());
                digestsDefined.add(folder.UnPackCRCDefined);
                digests.add(folder.UnPackCRC);
            }
        }
       
View Full Code Here


            }
        }
    }
   
    private Vector ReadAndDecodePackedStreams(long baseOffset, int dataStartPosIndex) throws IOException {
        LongVector packSizes = new LongVector();
       
        BoolVector packCRCsDefined = new BoolVector();
        IntVector packCRCs = new IntVector();
       
        long type = this.inStream.ReadID();
        assert (type == Header.NID.kPackInfo);
        this.ReadPackInfo(packSizes, packCRCsDefined, packCRCs, dataStartPosIndex);
       
        type = this.inStream.ReadID();
        assert (type == Header.NID.kUnPackInfo);
        Vector folders = ReadUnPackInfo(null);
       
        type = this.inStream.ReadID();
        assert (type == Header.NID.kEnd);
       
        int packIndex = 0;
        Decoder decoder = new Decoder(false); // _ST_MODE
       
        Vector dataVector = new Vector();
        long dataStartPos = baseOffset + ((dataStartPosIndex == 0) ?
            this.ArchiveInfo.DataStartPosition : this.ArchiveInfo.DataStartPosition2);
        for(int i=0; i<folders.size(); i++) {
            Folder folder = (Folder)folders.get(i);
            long unPackSize = folder.GetUnPackSize();
            if (unPackSize > InStream.kNumMax || unPackSize > 0xFFFFFFFFL)
                throw new IOException("unPackSize too great: " + unPackSize);
           
            ByteArrayOutputStream baos = new ByteArrayOutputStream((int)unPackSize);
            decoder.Decode(
                this.inStream.stream, dataStartPos,
                    packSizes, packIndex,
                    folder, baos, null);
            byte[] data; // TODO: stream belassen!
            dataVector.add(data = baos.toByteArray());
           
            if (folder.UnPackCRCDefined)
                if (!CRC.VerifyDigest(folder.UnPackCRC, data, (int)unPackSize))
                    throw new IOException("Incorrect Header, CRCs of packed folder don't match: archive: " +
                        Integer.toHexString(folder.UnPackCRC) + ", calculated: " +
                        Integer.toHexString(CRC.CalculateDigest(data, (int)unPackSize)) +
                        ". Either is the archive corrupted or an internal error occured");
           
            for (int j = 0; j < folder.PackStreams.size(); j++)
                dataStartPos += packSizes.get(packIndex++);
        }
       
        return dataVector;
    }
View Full Code Here

    int packStreamIndex = 0, unPackStreamIndex = 0;
    for (int i=0; i<folderInfo.Coders.size(); i++) {
      CoderInfo coderInfo = (CoderInfo)folderInfo.Coders.get(i);
      int numInStreams = coderInfo.NumInStreams;
      int numOutStreams = coderInfo.NumOutStreams;
      LongVector packSizesPointers = new LongVector(); // CRecordVector<const UInt64 *>
      LongVector unPackSizesPointers = new LongVector(); // CRecordVector<const UInt64 *>
      packSizesPointers.Reserve(numInStreams);
      unPackSizesPointers.Reserve(numOutStreams);
      int j;
     
      for (j=0; j<numOutStreams; j++, unPackStreamIndex++)
        unPackSizesPointers.add(folderInfo.UnPackSizes.get(unPackStreamIndex));
      
      for (j=0; j<numInStreams; j++, packStreamIndex++) {
        final long packSizesPointer;
        final int bindPairIndex = folderInfo.FindBindPairForInStream(packStreamIndex);
        final int index;
View Full Code Here

TOP

Related Classes of Common.LongVector

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.