XML データを文字列としてマーシャリングし、バイトに変換しgetBytes(StandardCharsets.UTF_8)
て記録キューに書き込みます。
try (DocumentContext dc = appender.writingDocument()) {
Wire wire = dc.wire();
Bytes bytes = wire.bytes();
bytes.write(message);
}
そしてこのように読む:
DocumentContext dc = tailer.readingDocument();
if (dc.isPresent()) {
Bytes bytes = dc.wire().bytes();
int length = bytes.length();
byte[] output = new byte[length];
bytes.read(output);
return output;
}
バッファーを読み戻すと、ほとんどのバッファー サイズは一致しますが、100 分の 1 のような一部のバッファーでは、追加のバイト (0x008F の 1/2/3 バイト) が取得されます。どのバッファーにこのパディングがあるかを特定できず、このパディングのためにバッファーを実際に非整列化できませんでした。一部のバッファにこれらの余分なバイトがある理由を理解できませんでしたか?