: 지금은 바이트에서 Channel
을 제거하기 위해 노력하고있어자바 : 바이트 배열에서 첫 번째 UTF 문자열을 제거 내가 바이트 배열로부터 서면 문자열을 제거하고 원래 별도의 개체를 유지하기 위해 노력하고있어
byte[] data... // this is populated with the following:
// 00094E6966747943686174001C00074D657373616765000B4372616674656446757279000474657374
// to string using converter : " ChannelMessageUsernametest"
// notice that tab/whitespace, ignore quotes
// The byte array was compiled by writing the following (writeUTF from a writer):
// Channel
// Message
// Username
// test
을 배열 : 나는 분리를 잃게하는 방법을 참조하십시오
byte[] newData = Arrays.copyOfRange(data, channel.length() + 2, data.length)
// I use Arrays.copyOfRange to strip the whitespace (I assume it's not needed)
// As well, since it's inclusive of length size, I have to add 1 more,
// resulting in channel.length() + 1
// ...
ByteArrayDataInput newInput = ByteStreams.newDataInput(message);
String channel = newInput.readUTF(); // MessageUsernametext
: 여기
ByteArrayDataInput input = ByteStreams.newDataInput(message);
String channel = input.readUTF(); // Channel, don't want this
String message = input.readUTF(); // Message
// works good, but I don't want Channel,
// and I can't remove it from the data before it arrives,
// I have to work with what I have
내 문제입니다 개체의 원본 "섹션"을 원래 byte[] data
안에있는 byte[] newData
안에 보관할 수 있습니까?
- 이
String channel
은 (이전과 제거 후) 문자열 그것이