Hi everyone
What kind of streams do I need to use to copy large files into a memory stream, process the data and copy it to a new file?
Printable View
Hi everyone
What kind of streams do I need to use to copy large files into a memory stream, process the data and copy it to a new file?
well i am not sure, but i will say use System.IO.BufferedStream . Because it works most like MemoryStream and it is constructed or initialised to some other existing Stream, in your case it could be a Text file, so you wont require external writing to a file using FileStream.
just my 2 cents.
How would I write into the buffer synchronously if the BufferedStream doesn't support seekingQuote:
Originally Posted by Harsh Gupta
FR is a FileStream (reader)
ES is a stream
FW is a FileStream (writer)
in case the code helps you, the problem is the BufferedStream doesn't support seeking and I don't know what kind of stream to useVB Code:
Dim BR As New System.IO.BufferedStream(Es) Dim buffer(1024) As Byte While FR.Position < FR.Length FR.Read(buffer, 0, 1024) BR.Write(buffer, 0, buffer.Length) End While Es.Close() FR.Close() While BR.Position < BR.Length Dim X As Integer = BR.ReadByte() If X <> -1 Then FW.WriteByte(CByte(X)) End If End While
EDIT: I decided not use the MemoryStream