예제 #1
0
 /// <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();
 }
예제 #2
0
 /// <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);
 }
예제 #3
0
            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));
            }