コード例 #1
0
ファイル: DirmChunk.cs プロジェクト: sahwar/DjvuNet
        /// <summary>
        /// Reads the compressed data from the djvu file
        /// </summary>
        /// <param name="reader"></param>
        /// <param name="count"></param>
        /// <param name="compressedSectionLength"></param>
        internal void ReadCompressedData(IDjvuReader reader, int count, int compressedSectionLength)
        {
            long prevPos = reader.Position;

            BzzReader bzReader = reader.GetBZZEncodedReader(compressedSectionLength);

            // Read the component sizes
            for (int x = 0; x < count; x++)
            {
                _components[x].Size = bzReader.ReadInt24BigEndian();
            }

            // Read the component flag information
            for (int x = 0; x < count; x++)
            {
                _components[x].DecodeFlags(bzReader.ReadByte());
            }

            // Read the component strings
            for (int x = 0; x < count; x++)
            {
                _components[x].ID = bzReader.ReadNullTerminatedString();
                if (_components[x].HasName == true)
                {
                    _components[x].Name = bzReader.ReadNullTerminatedString();
                }

                if (_components[x].HasTitle == true)
                {
                    _components[x].Title = bzReader.ReadNullTerminatedString();
                }
            }

            _isInitialized = true;

            reader.Position = prevPos;
        }