All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.tinkerpop.rexster.protocol.serializer.msgpack.templates.messages.SessionRequestMessageTemplate Maven / Gradle / Ivy

There is a newer version: 2.6.0
Show newest version
package com.tinkerpop.rexster.protocol.serializer.msgpack.templates.messages;

import com.tinkerpop.rexster.protocol.msg.SessionRequestMessage;
import org.msgpack.packer.Packer;
import org.msgpack.unpacker.Unpacker;

import java.io.IOException;

/**
 * @author Blake Eggleston (bdeggleston.github.com)
 */
public class SessionRequestMessageTemplate extends RexProMessageTemplate {

    protected int messageArraySize() {
        return super.messageArraySize() + 2;
    }

    protected SessionRequestMessage instantiateMessage() {
        return new SessionRequestMessage();
    }

    protected void writeMessageArray(final Packer pk, final SessionRequestMessage msg) throws IOException {
        super.writeMessageArray(pk, msg);
        pk.write(msg.Username);
        pk.write(msg.Password);
    }

    protected SessionRequestMessage readMessageArray(final Unpacker un, final SessionRequestMessage msg) throws IOException {
        SessionRequestMessage message = super.readMessageArray(un, msg);
        message.Username = un.trySkipNil()?null:un.readString();
        message.Password = un.trySkipNil()?null:un.readString();
        return message;
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy