Package com.taobao.gecko.core.buffer

Examples of com.taobao.gecko.core.buffer.IoBuffer


    public IoBuffer encode() {
        if (StringUtils.isBlank(this.item)) {
            return IoBuffer.wrap((MetaEncodeCommand.STATS_CMD + " " + " " + this.getOpaque() + "\r\n").getBytes());
        }
        else {
            final IoBuffer buf = IoBuffer.allocate(9 + this.item.length() + ByteUtils.stringSize(this.getOpaque()));
            ByteUtils.setArguments(buf, MetaEncodeCommand.STATS_CMD, this.item, this.getOpaque());
            buf.flip();
            return buf;
        }
    }
View Full Code Here



    @Override
    public IoBuffer encode() {
        final int dataLen = this.data == null ? 0 : this.data.length;
        final IoBuffer buffer =
                IoBuffer.allocate(13 + ByteUtils.stringSize(this.partition) + ByteUtils.stringSize(dataLen)
                    + ByteUtils.stringSize(this.getOpaque()) + this.getTopic().length()
                    + ByteUtils.stringSize(this.msgId) + ByteUtils.stringSize(this.flag)
                    + ByteUtils.stringSize(this.checkSum) + dataLen);

        ByteUtils.setArguments(buffer, MetaEncodeCommand.SYNC_CMD, this.getTopic(), this.partition, dataLen, this.flag,
            this.msgId, this.checkSum, this.getOpaque());

        if (this.data != null) {
            buffer.put(this.data);
        }
        buffer.flip();
        return buffer;
    }
View Full Code Here

TOP

Related Classes of com.taobao.gecko.core.buffer.IoBuffer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.