1、读取文件,转换为字节流

FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read);

byte[] bytesRead = new byte[(int)fs.Length];

fs.Read(bytesRead, 0, bytesRead.Length);

fs.Close();

return bytesRead;

2、将字节流写入文件

byte[] bytesWrite = ….

FileStream fs = new FileStream(“xxx”,FileMode.Create, FileAccess.Write);

fs.Write(bytesWrite, 0, bytesWrite.Length);

fs.Close();

相关文章:

  • 2021-09-08
  • 2022-01-13
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-10
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-11-26
  • 2022-12-23
  • 2022-01-16
  • 2021-06-10
  • 2022-12-23
  • 2021-11-07
  • 2022-01-13
相关资源
相似解决方案