/// <summary>
 /// Opens a part stream for write-only access
 /// </summary>
 public PartStreamImpl(CompoundStream ownerStream, int index, int blockSize)
 {
     Index         = index;
     CanRead       = false;
     CanWrite      = true;
     m_ownerStream = ownerStream;
     BlockSize     = blockSize;
     CurrentBlockWriteBufferStream = new MemoryStream();
 }
 /// <summary>
 /// Opens a part stream for read-only access
 /// </summary>
 public PartStreamImpl(CompoundStream ownerStream, int index, int blockSize, long length, long[] blockStarts)
 {
     Index         = index;
     CanRead       = true;
     CanWrite      = false;
     m_ownerStream = ownerStream;
     BlockSize     = blockSize;
     m_length      = length;
     m_blockStarts.AddRange(blockStarts);
 }
            public static PartStreamImpl ReadPartStream(CompoundStream compoundStream, int index, BuildXLReader reader)
            {
                var blockSize  = reader.ReadInt32Compact();
                var partLength = reader.ReadInt64Compact();
                var blockCount = reader.ReadInt32Compact();

                long[] blockStarts    = new long[blockCount];
                long   lastBlockStart = 0;

                for (int i = 0; i < blockCount; i++)
                {
                    var blockStart = reader.ReadInt64Compact() + lastBlockStart;
                    blockStarts[i] = blockStart;
                    lastBlockStart = blockStart;
                }

                return(new PartStreamImpl(compoundStream, index, blockSize, partLength, blockStarts));
            }