com.tinkerpop.rexster.protocol.serializer.msgpack.templates.messages.MsgPackScriptResponseMessageTemplate 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.serializer.msgpack.templates.messages;
import com.tinkerpop.rexster.protocol.msg.ScriptResponseMessage;
import com.tinkerpop.rexster.protocol.serializer.msgpack.templates.BindingsTemplate;
import com.tinkerpop.rexster.protocol.serializer.msgpack.templates.ResultsTemplate;
import org.msgpack.packer.Packer;
import org.msgpack.unpacker.Unpacker;
import java.io.IOException;
/**
* @author Blake Eggleston (bdeggleston.github.com)
*/
public class MsgPackScriptResponseMessageTemplate extends RexProMessageTemplate {
protected int messageArraySize() {
return super.messageArraySize() + 2;
}
@Override
protected ScriptResponseMessage instantiateMessage() {
return new ScriptResponseMessage();
}
@Override
protected ScriptResponseMessage readMessageArray(final Unpacker un, final ScriptResponseMessage msg) throws IOException {
ScriptResponseMessage message = super.readMessageArray(un, msg);
message.Results = ResultsTemplate.getInstance().read(un, null);
message.Bindings = BindingsTemplate.getInstance().read(un, null);
return message;
}
@Override
protected void writeMessageArray(final Packer pk, final ScriptResponseMessage msg) throws IOException {
super.writeMessageArray(pk, msg);
ResultsTemplate.getInstance().write(pk, msg.Results);
BindingsTemplate.getInstance().write(pk, msg.Bindings);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy