Dim ins As InputStream
ins = File.OpenInput(FileFolder, FileName)
Dim iCount As Int = 0
Dim lngBytesAv As Long = ins.BytesAvailable
Log ("Bytes Available:" & lngBytesAv)
Dim iBLen As Int = 512
Do While lngBytesAv >= iCount
Log(lngBytesAv)
Log(iCount)
If lngBytesAv - iCount < 512 Then
iBLen = lngBytesAv - iCount
If iBLen = 0 Then
Exit
End If
End If
Log(iBLen)
Dim bToSend(iBLen) As Byte
ins.ReadBytes(bToSend, iCount, bToSend.Length)
iCount = iCount + iBLen
ProcessByteArray(bToSend)
Loop