Sub ReadFile(Dir As String, FileName As String)
Try
Dir = Dir & "/"
Log("Getting file:" & Dir & FileName)
Dim size As Long = File.Size(Dir,FileName)
Dim f As RandomAccessFile
f.Initialize(Dir,FileName,True)
Log(f.Size)
Do While f.CurrentPosition < size
Dim part() As Byte
f.ReadBytes(part,0,1024,f.CurrentPosition)
astream2.Write(part)
Loop
f.Close
astream2.Write("EOFEOFEOFEOFEOFX".GetBytes("UTF-8"))
Catch
Dim err As String = "notfound " & LastException.Message
astream2.Write(err.GetBytes("UTF-8"))
End Try
End Sub