本文整理匯總了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;
}