0

如何从本地文件创建DotCMIS.Data.IContentStream对象?

本教程仅描述如何从内存中的字节数组创建一个:

byte[] content = UTF8Encoding.UTF8.GetBytes("Hello World!");
ContentStream contentStream = new ContentStream();
contentStream.FileName = "hello-world.txt";
contentStream.MimeType = "text/plain";
contentStream.Length = content.Length;
contentStream.Stream = new MemoryStream(content);
4

1 回答 1

0

Stream 实际上是 .NET 的标准System.IO.Stream,所以这里是如何从本地文件创建 DotCMIS IContentStream:

ContentStream contentStream = new ContentStream();
contentStream.FileName = "hello-world.txt";
contentStream.MimeType = "text/plain";
contentStream.Stream = File.Open("hello-world.txt", FileMode.Open);
contentStream.Length = contentStream.Stream.Length;
于 2014-06-27T03:07:23.090 回答