本文整理汇总了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);
}
示例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);
}
示例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;
}