Sub dd_Complete(Job As HttpJob)
If Job.Success Then
ProgressBar2.Visible=False
lblProgress.Text="Download completed"
size=Job.GetInputStream.BytesAvailable
Log(size)
File.MakeDir(File.DirDefaultExternal, "Busy")
Dim out As OutputStream = File.OpenOutput(File.DirDefaultExternal & "/Busy" , FileName, False)
File.Copy2(Job.GetInputStream, out)
Dim Buffer() As Byte 'declares an empty array
out.InitializeToBytesArray(size)
Buffer = out.ToBytesArray
out.WriteBytes(Buffer,0,Buffer.Length)
out.Close
Else
Log("Error: " & Job.ErrorMessage)
End If