Package Common

Examples of Common.BoolVector


        }
       
        final ArrayList bsizes = new ArrayList();
        do {
            if (type == Header.NID.kCRC) {
                BoolVector digestsDefined2 = new BoolVector();
                IntVector digests2 = new IntVector();
                digests2 = this.inStream.ReadHashDigests(numDigests, digestsDefined2);
                int digestIndex = 0;
               
                for (int i=0; i<folders.size(); i++) {
                  numSubstreams = numUnPackStreamsInFolders.get(i);
                  Folder folder = (Folder)folders.get(i);
                  if (numSubstreams == 1 && folder.UnPackCRCDefined) {
                    bsizes.add(Boolean.TRUE);
                    sizes.add(new Integer(folder.UnPackCRC));
                  } else {
                    for (int j=0; j<numSubstreams; j++, digestIndex++) {
                      bsizes.add(new Boolean(digestsDefined2.get(digestIndex)));
                      sizes.add(new Integer(digests2.get(digestIndex)));
                    }
                  }
                }
                digestsDefined.addAll(bsizes);
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);
View Full Code Here

        }
        streamSwitch.close();
    }
   
    private void ReadFileAttributes(Vector from) throws IOException {
        BoolVector boolVector = this.inStream.ReadBoolVector2(this.Files.size());
        StreamSwitch streamSwitch = new StreamSwitch();
        streamSwitch.Set(this.inStream, from);
        for (int i=0; i<this.Files.size(); i++) {
            FileItem file = (FileItem)this.Files.get(i);
            file.AreAttributesDefined = boolVector.get(i);
            if (file.AreAttributesDefined)
                file.Attributes = this.inStream.ReadUInt32();
        }
        streamSwitch.close();
    }
View Full Code Here

        }
        streamSwitch.close();
    }
   
    private void ReadFileStartPositions(Vector from) throws IOException {
        BoolVector boolVector = this.inStream.ReadBoolVector2(this.Files.size());
        StreamSwitch streamSwitch = new StreamSwitch();
        streamSwitch.Set(this.inStream, from);
        for(int i=0; i<this.Files.size(); i++) {
            FileItem file = (FileItem)this.Files.get(i);
            file.IsStartPosDefined = boolVector.get(i);
            if (file.IsStartPosDefined)
                file.StartPos = this.inStream.ReadUInt64();
        }
        streamSwitch.close();
    }
View Full Code Here

        }
        streamSwitch.close();
    }
   
    private void ReadTime(Vector dataVector, long type) throws IOException {
        BoolVector boolVector = this.inStream.ReadBoolVector2(this.Files.size());
       
        StreamSwitch streamSwitch = new StreamSwitch();
        streamSwitch.Set(this.inStream, dataVector);
       
        for (int i=0; i<this.Files.size(); i++) {
            FileItem file = (FileItem)this.Files.get(i);
            int low = 0;
            int high = 0;
            boolean defined = boolVector.get(i);
            if (defined) {
                low = this.inStream.ReadUInt32();
                high = this.inStream.ReadUInt32();
            }
            switch((int)type) {
View Full Code Here

        }
       
        long type;
        while ((type = this.inStream.ReadID()) != Header.NID.kEnd) {
            if (type == Header.NID.kCRC) {
                BoolVector crcsDefined = new BoolVector();
                IntVector crcs = new IntVector();
                crcs = this.inStream.ReadHashDigests(numFolders, crcsDefined);
                for (int i=0; i<numFolders; i++) {
                    Folder folder = (Folder)folders.get(i);
                    folder.UnPackCRCDefined = crcsDefined.get(i);
                    folder.UnPackCRC = crcs.get(i);
                }
                continue;
            }
            this.inStream.SkeepData();
View Full Code Here

    public void close() throws IOException {
        if (this.stream != null) this.stream.close(); // _stream.Release();
    }
   
    public BoolVector ReadBoolVector(int numItems) throws IOException {
        BoolVector v = new BoolVector(numItems);
        int b = 0;
        int mask = 0;
        for (int i=0; i<numItems; i++) {
            if (mask == 0) {
                b = ReadByte();
                mask = 0x80;
            }
            v.add((b & mask) != 0);
            mask >>= 1;
        }
        return v;
    }
View Full Code Here

   
    public BoolVector ReadBoolVector2(int numItemsthrows IOException { // CBoolVector
        int allAreDefined = ReadByte();
        if (allAreDefined == 0)
            return ReadBoolVector(numItems);
        BoolVector v = new BoolVector(numItems);
        for (int i = 0; i < numItems; i++)
            v.add(true);
        return v;
    }
View Full Code Here

            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);
            }
        }
       
        if (type == Header.NID.kEnd)
View Full Code Here

        this.Files.clear();
        this.Files.ensureCapacity(numFiles);
        for (int i=0; i<numFiles; i++)
            this.Files.add(new FileItem());
       
        BoolVector emptyStreamVector = new BoolVector();
        emptyStreamVector.Reserve(numFiles);
        for(int i = 0; i < numFiles; i++)
            emptyStreamVector.add(false);
        BoolVector emptyFileVector = new BoolVector();
        BoolVector antiFileVector = new BoolVector();
        int numEmptyStreams = 0;
       
        long type;
        while ((type = this.inStream.ReadID()) != Header.NID.kEnd) {
            long size = this.inStream.ReadNumber();
            this.ArchiveInfo.FileInfoPopIDs.add(type);
            switch((int)type) {
                case Header.NID.kEmptyStream:
                    emptyStreamVector.setBoolVector(this.inStream.ReadBoolVector(numFiles));
                    for (int i=0; i<emptyStreamVector.size(); i++)
                        if (emptyStreamVector.get(i))
                            numEmptyStreams++;
                    emptyFileVector.Reserve(numEmptyStreams);
                    antiFileVector.Reserve(numEmptyStreams);
                    for (int i = 0; i < numEmptyStreams; i++) {
                        emptyFileVector.add(false);
                        antiFileVector.add(false);
                    }
                    break;
                case Header.NID.kName:         this.ReadFileNames(dataVector); break;
                case Header.NID.kWinAttributes:   this.ReadFileAttributes(dataVector); break;
                case Header.NID.kStartPos:       this.ReadFileStartPositions(dataVector); break;
                case Header.NID.kEmptyFile:     emptyFileVector.setBoolVector(this.inStream.ReadBoolVector(numEmptyStreams)); break;
                case Header.NID.kAnti:         antiFileVector.setBoolVector(this.inStream.ReadBoolVector(numEmptyStreams)); break;
                case Header.NID.kCreationTime:
                case Header.NID.kLastWriteTime:
                case Header.NID.kLastAccessTime:   this.ReadTime(dataVector, type); break;
                default:
                    this.ArchiveInfo.FileInfoPopIDs.DeleteBack();
                    this.inStream.SkeepData(size);
                    break;
            }
        }
       
        int emptyFileIndex = 0;
        int sizeIndex = 0;
        for(int i = 0; i < numFiles; i++) {
            FileItem file = (FileItem)this.Files.get(i);
            file.HasStream = !emptyStreamVector.get(i);
            if(file.HasStream) {
                file.IsDirectory = false;
                file.IsAnti = false;
                file.UnPackSize = unPackSizes.get(sizeIndex);
                file.FileCRC = digests.get(sizeIndex);
                file.IsFileCRCDefined = digestsDefined.get(sizeIndex);
                sizeIndex++;
            } else {
                file.IsDirectory = !emptyFileVector.get(emptyFileIndex);
                file.IsAnti = antiFileVector.get(emptyFileIndex);
                emptyFileIndex++;
                file.UnPackSize = 0;
                file.IsFileCRCDefined = false;
            }
        }
View Full Code Here

TOP

Related Classes of Common.BoolVector

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.