Package io.netty.buffer

Examples of io.netty.buffer.ByteBuf.writeShort()


        //* byte[2]  serializeType-(attr-index)           序列化策略
        bodyBuf.writeShort(resMsg.getSerializeType());
        //* byte[2]  returnType-(attr-index)              返回类型
        bodyBuf.writeShort(resMsg.getReturnType());
        //* byte[2]  returnData-(attr-index)              返回数据
        bodyBuf.writeShort(resMsg.getReturnData());
        //* --------------------------------------------------------bytes =1 ~ 1021
        //* byte[1]  optionCount                          选项参数总数
        int[] optionMapping = resMsg.getOptions();
        bodyBuf.writeByte(optionMapping.length);
        for (int i = 0; i < optionMapping.length; i++) {
View Full Code Here


            bodyBuf.writeInt(optionMapping[i]);
        }
        //* --------------------------------------------------------bytes =6 ~ 8192
        //* byte[2]  attrPool-size (Max = 2047)           池大小 0x07FF
        int[] poolData = resMsg.getPoolData();
        bodyBuf.writeShort(poolData.length);
        for (int i = 0; i < poolData.length; i++) {
            //* byte[4]  ptype-0-(attr-index,attr-index)  属性1大小
            //* byte[4]  ptype-1-(attr-index,attr-index)  属性2大小
            bodyBuf.writeInt(poolData[i]);
        }
View Full Code Here

    //
    private ByteBuf encodeRequest(RequestSocketBlock reqMsg) {
        ByteBuf bodyBuf = ByteBufAllocator.DEFAULT.heapBuffer();
        //* --------------------------------------------------------bytes =14
        //* byte[2]  servicesName-(attr-index)            远程服务名
        bodyBuf.writeShort(reqMsg.getServiceName());
        //* byte[2]  servicesGroup-(attr-index)           远程服务分组
        bodyBuf.writeShort(reqMsg.getServiceGroup());
        //* byte[2]  servicesVersion-(attr-index)         远程服务版本
        bodyBuf.writeShort(reqMsg.getServiceVersion());
        //* byte[2]  servicesMethod-(attr-index)          远程服务方法名
View Full Code Here

        ByteBuf bodyBuf = ByteBufAllocator.DEFAULT.heapBuffer();
        //* --------------------------------------------------------bytes =14
        //* byte[2]  servicesName-(attr-index)            远程服务名
        bodyBuf.writeShort(reqMsg.getServiceName());
        //* byte[2]  servicesGroup-(attr-index)           远程服务分组
        bodyBuf.writeShort(reqMsg.getServiceGroup());
        //* byte[2]  servicesVersion-(attr-index)         远程服务版本
        bodyBuf.writeShort(reqMsg.getServiceVersion());
        //* byte[2]  servicesMethod-(attr-index)          远程服务方法名
        bodyBuf.writeShort(reqMsg.getTargetMethod());
        //* byte[2]  serializeType-(attr-index)           序列化策略
View Full Code Here

        //* byte[2]  servicesName-(attr-index)            远程服务名
        bodyBuf.writeShort(reqMsg.getServiceName());
        //* byte[2]  servicesGroup-(attr-index)           远程服务分组
        bodyBuf.writeShort(reqMsg.getServiceGroup());
        //* byte[2]  servicesVersion-(attr-index)         远程服务版本
        bodyBuf.writeShort(reqMsg.getServiceVersion());
        //* byte[2]  servicesMethod-(attr-index)          远程服务方法名
        bodyBuf.writeShort(reqMsg.getTargetMethod());
        //* byte[2]  serializeType-(attr-index)           序列化策略
        bodyBuf.writeShort(reqMsg.getSerializeType());
        //* byte[4]  clientTimeout                        远程客户端超时时间
View Full Code Here

        //* byte[2]  servicesGroup-(attr-index)           远程服务分组
        bodyBuf.writeShort(reqMsg.getServiceGroup());
        //* byte[2]  servicesVersion-(attr-index)         远程服务版本
        bodyBuf.writeShort(reqMsg.getServiceVersion());
        //* byte[2]  servicesMethod-(attr-index)          远程服务方法名
        bodyBuf.writeShort(reqMsg.getTargetMethod());
        //* byte[2]  serializeType-(attr-index)           序列化策略
        bodyBuf.writeShort(reqMsg.getSerializeType());
        //* byte[4]  clientTimeout                        远程客户端超时时间
        bodyBuf.writeInt(reqMsg.getClientTimeout());
        //* --------------------------------------------------------bytes =1 ~ 1021
View Full Code Here

        //* byte[2]  servicesVersion-(attr-index)         远程服务版本
        bodyBuf.writeShort(reqMsg.getServiceVersion());
        //* byte[2]  servicesMethod-(attr-index)          远程服务方法名
        bodyBuf.writeShort(reqMsg.getTargetMethod());
        //* byte[2]  serializeType-(attr-index)           序列化策略
        bodyBuf.writeShort(reqMsg.getSerializeType());
        //* byte[4]  clientTimeout                        远程客户端超时时间
        bodyBuf.writeInt(reqMsg.getClientTimeout());
        //* --------------------------------------------------------bytes =1 ~ 1021
        //* byte[1]  paramCount                           参数总数
        int[] paramMapping = reqMsg.getParameters();
View Full Code Here

            bodyBuf.writeInt(optionMapping[i]);
        }
        //* --------------------------------------------------------bytes =6 ~ 8192
        //* byte[2]  attrPool-size (Max = 2047)           池大小 0x07FF
        int[] poolData = reqMsg.getPoolData();
        bodyBuf.writeShort(poolData.length);
        for (int i = 0; i < poolData.length; i++) {
            //* byte[4]  ptype-0-(attr-index,attr-index)  属性1大小
            //* byte[4]  ptype-1-(attr-index,attr-index)  属性1大小
            bodyBuf.writeInt(poolData[i]);
        }
View Full Code Here

  public static final class Encoder extends MessageToMessageEncoder<BlockResponse> {
    private static final int MESSAGE_LENGTH = Shorts.BYTES + Longs.BYTES * 3;

    private ByteBuf createHeader(final ChannelHandlerContext ctx, final BlockResponse msg) {
      ByteBuf header = ctx.alloc().buffer(MESSAGE_LENGTH);
      header.writeShort(DataServerMessage.DATA_SERVER_RESPONSE_MESSAGE);
      header.writeLong(msg.getBlockId());
      header.writeLong(msg.getOffset());
      header.writeLong(msg.getLength());
      return header;
    }
View Full Code Here

            LOGGER.error("Could not find a filter for given message.");
            return;
        }
       
        // write the header
        result.writeShort(header);

        // serialize the message
        filter.serialize(result, message);
    }
   
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.