Home > Net >  C # read video stream into a string to send a lot of character to do less?
C # read video stream into a string to send a lot of character to do less?

Time:10-03

One of my demand is to put the video or other binary file read into the string, the file is very big, I use the FileStream read to byte array into a string, and other places then converted to an array of written to the file, but the final written after the file is missing a lot of things, can you provide a solution, please? For instance the video read what is converted into a string to send out in other places to write again, hope to provide a train of thought or function, didn't get the official document,

CodePudding user response:

 class Program 
{

Public static Dictionary OpenWith=new Dictionary (a);
Public static void a Write (string path)
{
FileStream writer=new FileStream (path, FileMode. Create);
UTF8Encoding temp and=new UTF8Encoding (); and
For (int I=0; I & lt; OpenWith. Count; I++)
{
Writer. Write (temp. GetBytes (openWith [i++]));
}
}
Public static void Read (string path)
{
FileStream reader=new FileStream (path, FileMode. Open);
Byte [] b=new byte [1024 * 32];
UTF8Encoding temp and=new UTF8Encoding (); and
Int I=0;
While (reader. Read (b, 0, b.L ength) & gt; 0)
{
OpenWith. Add (i++, temp. Get string (b));
}
}
Public static void Main ()
{
String path=@ "D: \ 1. Mp4";
Read (path);
Write (@ "E: \ Desktop \ tt mp4");
}
}


This is my code, write after missing a lot of things
  •  Tags:  
  • C#
  • Related