コード例 #1
0
ファイル: TFirkinStream.cs プロジェクト: samus/Firkin
 public void Can_memorize_large_stream()
 {
     var stream = CreateStream(100000);
     var length = 90000;
     var fs = new FirkinStream(new StreamSyncRoot(), stream, 1000, length);
     fs.Memorize();
     Assert.IsTrue(fs.IsMemorized);
     var bytes = fs.ReadBytes();
     Assert.AreEqual(length, bytes.Length);
     stream.Position = 1000;
     Assert.AreEqual(0, stream.ReadBytes(length).Compare(bytes));
 }
コード例 #2
0
ファイル: TFirkinStream.cs プロジェクト: kouweizhong/Firkin
        public void Can_read_large_stream_directly_as_single_chunk()
        {
            var stream = CreateStream(100000);
            var length = 90000;
            var fs     = new FirkinStream(new StreamSyncRoot(), stream, 1000, length);

            Assert.IsFalse(fs.IsMemorized);
            _log.Debug("starting read");
            var bytes = fs.ReadBytes();

            Assert.AreEqual(length, bytes.Length);
            stream.Position = 1000;
            Assert.AreEqual(0, stream.ReadBytes(length).Compare(bytes));
        }
コード例 #3
0
ファイル: TFirkinStream.cs プロジェクト: kouweizhong/Firkin
        public void Can_memorize_large_stream()
        {
            var stream = CreateStream(100000);
            var length = 90000;
            var fs     = new FirkinStream(new StreamSyncRoot(), stream, 1000, length);

            fs.Memorize();
            Assert.IsTrue(fs.IsMemorized);
            var bytes = fs.ReadBytes();

            Assert.AreEqual(length, bytes.Length);
            stream.Position = 1000;
            Assert.AreEqual(0, stream.ReadBytes(length).Compare(bytes));
        }
コード例 #4
0
ファイル: TFirkinStream.cs プロジェクト: samus/Firkin
 public void Can_read_large_stream_directly_as_single_chunk()
 {
     var stream = CreateStream(100000);
     var length = 90000;
     var fs = new FirkinStream(new StreamSyncRoot(), stream, 1000, length);
     Assert.IsFalse(fs.IsMemorized);
     _log.Debug("starting read");
     var bytes = fs.ReadBytes();
     Assert.AreEqual(length, bytes.Length);
     stream.Position = 1000;
     Assert.AreEqual(0, stream.ReadBytes(length).Compare(bytes));
 }