use of org.neo4j.bolt.v4.BoltRequestMessageWriterV4 in project neo4j by neo4j.
the class MessageConditions method serialize.
public static byte[] serialize(Neo4jPack neo4jPack, RequestMessage... messages) throws IOException {
RecordingByteChannel rawData = new RecordingByteChannel();
Neo4jPack.Packer packer = neo4jPack.newPacker(new BufferedChannelOutput(rawData));
BoltRequestMessageWriter writer = new BoltRequestMessageWriterV4(packer);
for (RequestMessage message : messages) {
writer.write(message);
}
writer.flush();
return rawData.getBytes();
}
use of org.neo4j.bolt.v4.BoltRequestMessageWriterV4 in project neo4j by neo4j.
the class FragmentedMessageDeliveryTest method serialize.
private byte[] serialize(int chunkSize, RequestMessage... msgs) throws IOException {
byte[][] serialized = new byte[msgs.length][];
for (int i = 0; i < msgs.length; i++) {
RecordingByteChannel channel = new RecordingByteChannel();
BoltRequestMessageWriter writer = new BoltRequestMessageWriterV4(new Neo4jPackV2().newPacker(new BufferedChannelOutput(channel)));
writer.write(msgs[i]).flush();
serialized[i] = channel.getBytes();
}
return Chunker.chunk(chunkSize, serialized);
}
Aggregations