Search in sources :

Example 1 with BoltResponseMessageReader

use of org.neo4j.bolt.messaging.BoltResponseMessageReader in project neo4j by neo4j.

the class MessageConditions method responseReader.

private static BoltResponseMessageReader responseReader(Neo4jPack neo4jPack, byte[] bytes) {
    ByteBufInput byteBufInput = new ByteBufInput();
    byteBufInput.start(Unpooled.wrappedBuffer(bytes));
    return new BoltResponseMessageReader(neo4jPack.newUnpacker(byteBufInput));
}
Also used : BoltResponseMessageReader(org.neo4j.bolt.messaging.BoltResponseMessageReader) ByteBufInput(org.neo4j.bolt.packstream.ByteBufInput)

Example 2 with BoltResponseMessageReader

use of org.neo4j.bolt.messaging.BoltResponseMessageReader in project neo4j by neo4j.

the class MessageConditions method responseMessage.

public static ResponseMessage responseMessage(Neo4jPack neo4jPack, byte[] bytes) throws IOException {
    BoltResponseMessageReader unpacker = responseReader(neo4jPack, bytes);
    BoltResponseMessageRecorder consumer = new BoltResponseMessageRecorder();
    try {
        unpacker.read(consumer);
        return consumer.asList().get(0);
    } catch (Throwable e) {
        throw new IOException("Failed to deserialize response, '" + e.getMessage() + "'.\n" + "Raw data: \n" + HexPrinter.hex(bytes), e);
    }
}
Also used : BoltResponseMessageRecorder(org.neo4j.bolt.messaging.BoltResponseMessageRecorder) BoltResponseMessageReader(org.neo4j.bolt.messaging.BoltResponseMessageReader) IOException(java.io.IOException)

Aggregations

BoltResponseMessageReader (org.neo4j.bolt.messaging.BoltResponseMessageReader)2 IOException (java.io.IOException)1 BoltResponseMessageRecorder (org.neo4j.bolt.messaging.BoltResponseMessageRecorder)1 ByteBufInput (org.neo4j.bolt.packstream.ByteBufInput)1