com.tinkerpop.rexster.gremlin.converter.MsgPackResultConverter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of rexster-protocol Show documentation
Show all versions of rexster-protocol Show documentation
RexPro is a binary protocol for Rexster graph server.
package com.tinkerpop.rexster.gremlin.converter;
import com.tinkerpop.rexster.protocol.serializer.msgpack.templates.ResultsConverter;
import org.msgpack.MessagePack;
import org.msgpack.packer.BufferPacker;
/**
* Converts a result from Gremlin to a byte array encoded by MsgPack.
*
* @author Blake Eggleston (bdeggleston.github.com)
*/
public class MsgPackResultConverter implements ResultConverter {
private final MessagePack msgpack = new MessagePack();
public byte[] convert(final Object result) throws Exception {
final BufferPacker packer = msgpack.createBufferPacker(1024);
try {
ResultsConverter.serializeObject(result, packer);
return packer.toByteArray();
} catch (Exception e) {
throw e;
} finally {
packer.close();
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy