FileStream继承了Stream
public byte[] ToByte(Stream stream
)
{
byte[] bytes
;
using (var ms
= new MemoryStream())
{
stream
.CopyTo(ms
);
bytes
= ms
.ToArray();
}
return bytes
;
}
byte[] ba
= ToByte(stream
);
string str64
= Encoding
.UTF8
.GetString(ba
);
string ct64
= Convert
.ToBase64String(ba
);
转载请注明原文地址:https://tech.qufami.com/read-11281.html