我有这个java代码:
ByteBuffer p = ByteBuffer.allocate(packet.length - 10 + 14);
p.order(ByteOrder.LITTLE_ENDIAN);
p.putInt(packet.length);
p.putInt(packet.request_id);
p.putInt(packet.type);
p.put(packet.paylod);
p.put((byte) 0);
p.put((byte) 0);
new DataOutputStream(sock.getOutputStream()).write(p.array());
我想把它翻译成 VB .NET 我从这个开始:
Dim p(packet.length - 10 + 14) As Byte
Dim Stream As MemoryStream = New MemoryStream()
Dim Writer As BinaryWriter = New BinaryWriter(Stream)
Using Writer
Writer.Write(packet.length)
Writer.Write(packet.request_id)
Writer.Write(packet.type)
Writer.Write(packet.paylod)
Writer.Write(CByte(0))
Writer.Write(CByte(0))
End Using
p = Stream.ToArray()
但是在我不知道如何按小端顺序排序之后