com.tinkerpop.rexster.protocol.msg.GraphSONScriptResponseMessage 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.protocol.msg;
import com.tinkerpop.blueprints.util.io.graphson.GraphSONMode;
import com.tinkerpop.rexster.gremlin.converter.JSONResultConverter;
/**
* Represents a response to a script request that formats results to GraphSON format. This is the same format
* that is used by the REST API.
*
* @author Stephen Mallette (http://stephen.genoprime.com)
*/
public class GraphSONScriptResponseMessage extends RexProMessage {
private static final JSONResultConverter converter = new JSONResultConverter(
GraphSONMode.EXTENDED, 0, Long.MAX_VALUE, null);
public byte[] Results;
public byte[] Bindings;
public static byte[] convertResultToBytes(final Object result) throws Exception {
return converter.convert(result).toString().getBytes();
}
@Override
public int estimateMessageSize() {
return BASE_MESSAGE_SIZE + (Results == null ? 0 : Results.length) + (Bindings == null ? 0 : Bindings.length);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy