Dim temp(512) As Byte
Dim Data(File.Size(...) - 1024) As Byte
Dim In As InputStream = File.OpenInput(...)
ReadBytesFully(In, temp, 512)
ReadBytesFully(In, Data, Data.Length)
In.Close
Dim out As OutputStream = File.OpenOutput(...)
out.WriteBytes(Data, 0, Data.Length)
out.Close
Private Sub ReadBytesFully(In As InputStream, Data() As Byte, Len As Int) As Byte()
Dim count = 0, read As Int
Do While count < Len AND read > -1
read = In.ReadBytes(Data, count, Len - count)
count = count + read
Loop
Return Data
End Sub