I am using Astreams Prefix to send files and found that when using write2 transmission works only partially and files are not sent fully.
I wrote this code to get over the problem and it works :
B4X:
count = raf.ReadBytes(buffer, 0, Min(8188,SizeM), position)
'AStreams.Write2(buffer,0,count) 'this write2 doesn't work ...
Dim tempbuf(count) As Byte
bc.ArrayCopy(buffer,0,tempbuf,0,count)
AStreams.Write(tempbuf)
Checked the java code posted in the thread you linked, I don't see anything wrong, but who knows of course. The user there suggested littleEndian, and I've just check my own aStreams initializations and they are done this way. I don't know, perhaps you could give it a try, if not already done so?
I work with LittleEndian. If both sides use the same way it works also with True, but I found that my PC program wants LittleEndian (B4ppc).
The problem above is a mystery since it works with write but not with write2, and they should be the same when setting start = 0 and count.