C# 从System.IO.Stream保存文件
我是这样写的:privatevoidWriteFile(System.IO.Streamstream,stringfilename){using(System.IO.St...
我是这样写的:
private void WriteFile(System.IO.Stream stream, string filename)
{
using (System.IO.StreamWriter objwrite = new System.IO.StreamWriter(filename))
{
int k = 0;
while (k != -1)
{
k = stream.ReadByte();
if (k != -1)
{
objwrite.BaseStream.WriteByte((byte)k);
}
}
}
}
但是保存起来极费时间。请问有没有更好的方法? 展开
private void WriteFile(System.IO.Stream stream, string filename)
{
using (System.IO.StreamWriter objwrite = new System.IO.StreamWriter(filename))
{
int k = 0;
while (k != -1)
{
k = stream.ReadByte();
if (k != -1)
{
objwrite.BaseStream.WriteByte((byte)k);
}
}
}
}
但是保存起来极费时间。请问有没有更好的方法? 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询