示例#1
0
        public void TestRead()
        {
            DocumentBlock[] blocks = new DocumentBlock[4];
            MemoryStream    input  = new MemoryStream(_testdata);

            for (int j = 0; j < 4; j++)
            {
                blocks[j] = new DocumentBlock(input, POIFSConstants.SMALLER_BIG_BLOCK_SIZE_DETAILS);
            }
            for (int j = 1; j <= 2000; j += 17)
            {
                byte[] buffer = new byte[j];
                int    offset = 0;

                for (int k = 0; k < (2000 / j); k++)
                {
                    DocumentBlock.Read(blocks, buffer, offset);
                    for (int n = 0; n < buffer.Length; n++)
                    {
                        Assert.AreEqual(_testdata[(k * j) + n], buffer[n]
                                        , "checking byte " + (k * j) + n);
                    }
                    offset += j;
                }
            }
        }
示例#2
0
 /// <summary>
 /// read data from the internal stores
 /// </summary>
 /// <param name="buffer">the buffer to write to</param>
 /// <param name="offset">the offset into our storage to read from</param>
 public virtual void Read(byte[] buffer, int offset)
 {
     if (this._property.ShouldUseSmallBlocks)
     {
         SmallDocumentBlock.Read(this._small_store.Blocks, buffer, offset);
     }
     else
     {
         DocumentBlock.Read(this._big_store.Blocks, buffer, offset);
     }
 }