internal CompoundDocument(Stream stream, FileHeader header)
        {
            this.FileStorage = stream;
            this.Reader = new BinaryReader(this.FileStorage);
            if (stream.CanWrite)
            {
                this.Writer = new BinaryWriter(this.FileStorage, Encoding.Unicode);
            }

            this.Header = header;
            this.SectorSize = (int)Math.Pow(2, Header.SectorSizeInPot);
            this.ShortSectorSize = (int)Math.Pow(2, Header.ShortSectorSizeInPot);
            this.TotalSectors = stream.Length == 0 ? 0
                : (int)(stream.Length - 512) / this.SectorSize;

            this.MasterSectorAllocation = new MasterSectorAllocation(this);
            this.SectorAllocation = new SectorAllocation(this);
            this.ShortSectorAllocation = new ShortSectorAllocation(this);
        }
        internal CompoundDocument(Stream stream, FileHeader header)
        {
            this.FileStorage = stream;
            this.Reader      = new BinaryReader(this.FileStorage);
            if (stream.CanWrite)
            {
                this.Writer = new BinaryWriter(this.FileStorage, Encoding.Unicode);
            }

            this.Header          = header;
            this.SectorSize      = (int)Math.Pow(2, Header.SectorSizeInPot);
            this.ShortSectorSize = (int)Math.Pow(2, Header.ShortSectorSizeInPot);
            this.TotalSectors    = stream.Length == 0 ? 0
                : (int)(stream.Length - 512) / this.SectorSize;

            this.MasterSectorAllocation = new MasterSectorAllocation(this);
            this.SectorAllocation       = new SectorAllocation(this);
            this.ShortSectorAllocation  = new ShortSectorAllocation(this);
        }