コード例 #1
0
        public CompressedContainer(XlBinaryReader CompressedData)
        {
            this.reader = CompressedData;

            this.CompressedRecordEnd = CompressedData.Length;

            // Read signature byte

            this.SignatureByte = CompressedData.ReadByte();
            SanityCheckSignatureByte(this.SignatureByte);

            //while (ArrayIndex < CompressedRecordEnd)
            while (!CompressedData.EndOfData)
            {
                var chunk = new CompressedChunk(CompressedData);
                _Chunks.Add(chunk);
            }

            //throw new NotImplementedException();
        }
コード例 #2
0
        public TokenSequence(XlBinaryReader CompressedData, int remainingBytes)
        {
            this.FlagByte = CompressedData.ReadByte();
            --remainingBytes;

            for (int i = 0; i < 8; i++)
            {
                if (remainingBytes == 0)
                {
                    break;
                }

                //int index = (i - 7) * (-1); // The most significant byte describes the first token. The second most significant byte the second token. etc. So we map 0 -> 7,   1 -> 6,   2 -> 5,   3 -> 4,   4 -> 3,   5 -> 2,   6 -> 1,   7 -> 0
                TokenType tokenType = GetTokenTypeAtIndex(i);

                if (tokenType == TokenType.CopyToken)
                {
                    var token = new CopyToken(CompressedData);
                    this._Tokens.Add(token);
                    remainingBytes -= token.GetSizeInBytes();
                }
                else if (tokenType == TokenType.LiteralToken)
                {
                    var token = new LiteralToken(CompressedData);
                    this._Tokens.Add(token);
                    remainingBytes -= token.GetSizeInBytes();
                }
                else
                {
                    throw new Exception();
                }


                // todo: last token sequence could contain less than 8 tokens
            }
        }
コード例 #3
0
 public LiteralToken(XlBinaryReader Data)
 {
     this.Data = Data.ReadByte();
 }