当前位置: 首页>>代码示例>>C#>>正文


C# MemoryBlockStream.Seek方法代码示例

本文整理汇总了C#中MimeKit.IO.MemoryBlockStream.Seek方法的典型用法代码示例。如果您正苦于以下问题:C# MemoryBlockStream.Seek方法的具体用法?C# MemoryBlockStream.Seek怎么用?C# MemoryBlockStream.Seek使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MimeKit.IO.MemoryBlockStream的用法示例。


在下文中一共展示了MemoryBlockStream.Seek方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Setup

		public void Setup ()
		{
			var bytes = new byte[9 * 1024];
			int position = 0;

			random = new Random ();
			random.NextBytes (bytes);

			// this is our master stream, all operations on the chained stream
			// should match the results on this stream
			master = new MemoryStream (bytes);
			mbuf = new byte[4096];
			buf = new byte[4096];

			// write the content into the memory block stream in random chunks
			blocks = new MemoryBlockStream ();

			Assert.IsTrue (blocks.CanRead, "Expected to be able to read from the memory block stream.");
			Assert.IsTrue (blocks.CanWrite, "Expected to be able to write to the memory block stream.");
			Assert.IsTrue (blocks.CanSeek, "Expected to be able to seek in the memory block stream.");
			Assert.IsFalse (blocks.CanTimeout, "Did not expect to be able to set timeouts in the memory block stream.");

			while (position < bytes.Length) {
				int n = Math.Min (bytes.Length - position, random.Next () % 4096);
				blocks.Write (bytes, position, n);
				position += n;
			}

			blocks.Seek (0, SeekOrigin.Begin);
		}
开发者ID:cybercircuits,项目名称:MimeKit,代码行数:30,代码来源:MemoryBlockStreamTests.cs

示例2: Setup

        public void Setup()
        {
            var bytes = new byte[9 * 1024];
            int position = 0;

            random = new Random ();
            random.NextBytes (bytes);

            // this is our master stream, all operations on the chained stream
            // should match the results on this stream
            master = new MemoryStream (bytes);
            mbuf = new byte[4096];
            buf = new byte[4096];

            // write the content into the memory block stream in random chunks
            blocks = new MemoryBlockStream ();
            while (position < bytes.Length) {
                int n = Math.Min (bytes.Length - position, random.Next () % 4096);
                blocks.Write (bytes, position, n);
                position += n;
            }

            blocks.Seek (0, SeekOrigin.Begin);
        }
开发者ID:vdaron,项目名称:MimeKit,代码行数:24,代码来源:MemoryBlockStreamTests.cs

示例3: ConstructMimePart

        unsafe BoundaryType ConstructMimePart(MimePart part, byte* inbuf)
        {
            BoundaryType found;
            Stream content;

            if (persistent) {
                long begin = GetOffset (inputIndex);
                long end;

                using (var measured = new MeasuringStream ()) {
                    found = ScanContent (inbuf, measured, true);
                    end = begin + measured.Length;
                }

                content = new BoundStream (stream, begin, end, true);
            } else {
                content = new MemoryBlockStream ();
                found = ScanContent (inbuf, content, true);
                content.Seek (0, SeekOrigin.Begin);
            }

            part.ContentObject = new ContentObject (content, part.ContentTransferEncoding);

            return found;
        }
开发者ID:princeoffoods,项目名称:MimeKit,代码行数:25,代码来源:MimeParser.cs


注:本文中的MimeKit.IO.MemoryBlockStream.Seek方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。