File copy with a Buffer and delay

ZeroEffect

Well-known member
Joined
Oct 24, 2004
Messages
180
Location
Detroit, MI
I know how to move/copy files with system.IO.File.Move & .copy but this does it as fast as possible which in most cases is great. I would like to be able to control the flow of the move/copy to keep the audio we stream across our network from skipping. Any thoughts I looked into stream readers and writers but that doesnt look like what I want to do.

Thanks

ZeroEffect
 
Anyone???

I found this example

Code:
	Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
		Dim fs As New FileStream("c:\dummy.txt", FileMode.Open)
		Dim tr As New BinaryReader(fs)
		While tr.BaseStream.Position < tr.BaseStream.Length
			Dim bytes(50) As Byte
			bytes = tr.ReadBytes(bytes.Length)
			ProcessBytes(bytes)
		End While
	End Sub
 
	Private Sub ProcessBytes(ByVal bytes() As Byte)
		Dim ascii As New ASCIIEncoding
		Dim decoded As String = ascii.GetString(bytes)
		TextBox1.AppendText(decoded)
	End Sub

But this reads a file then displays it into a text box. I want to copy it to a new location. Ill be messing with this example whiile at work tomorrow.

Thanks

ZeroEffect
 
Last edited by a moderator:
Well, you can setup a BinaryWriter to write those bytes to a file
Dim FS As Filestream = New Filestream(name, stuff, stuff)
Dim BW As BinaryWriter = New BinaryWriter(FS)

BW.Write(bytes)

:)
 
your suggestions worked great! Thanks! Ill post my find code when I get the subs completed they way I want them.

Thanks Again

ZeroEffect
 
Back
Top