Java/Androidで何かを行う方法について少し説明する必要があります。httpリクエストで送信できるように、バイト配列/データパケットを作成する必要があります。私はそれがこのように見える必要があります:
- 3 bytes reserved (zero padded)
- 1 byte - Operation Group
- 1 byte - Packet type
- the rest depends on the above
しかし、どうすればこのように構築できるのかわかりませんbyte[]
。
これが私が試したことです:
String padding = "0000000000"; // first part of packet
String group = "0xA"; // second part of packet
String type = "02"; // third part of packet
String content = "ThisIsATestStringWhichYouWillReadButItsADumbAssStringDudeSorryForYou"; // last part of packet
String wholePacket = padding.concat(group.concat(type.concat(content)));
Log.v("","wholePacket : "+wholePacket);
byte[] bytes = EncodingUtils.getBytes(wholePacket, "UTF-8");
助言がありますか?