Java 类io.netty.handler.codec.marshalling.MarshallingDecoder 实例源码

项目:webapp-tyust    文件:MarshallingCodeCFactory.java   
/**
   * 创建Jboss Marshalling解码器MarshallingDecoder
   * @return MarshallingDecoder
   */
  public static MarshallingDecoder buildMarshallingDecoder() {
    //首先通过Marshalling工具类的精通方法获取Marshalling实例对象 参数serial标识创建的是java序列化工厂对象。
final MarshallerFactory marshallerFactory = Marshalling.getProvidedMarshallerFactory("serial");
//创建了MarshallingConfiguration对象,配置了版本号为5 
final MarshallingConfiguration configuration = new MarshallingConfiguration();
configuration.setVersion(5);
//根据marshallerFactory和configuration创建provider
UnmarshallerProvider provider = new DefaultUnmarshallerProvider(marshallerFactory, configuration);
//构建Netty的MarshallingDecoder对象,俩个参数分别为provider和单个消息序列化后的最大长度
MarshallingDecoder decoder = new MarshallingDecoder(provider, 1024);
return decoder;
  }
项目:java_learn    文件:MarshallingCodeCFactory.java   
/**
 * 创建Jboss Marshalling解码器
 * @return
 */
public static MarshallingDecoder buildMarshallingDecoder() {
    MarshallerFactory factory = Marshalling.getProvidedMarshallerFactory("serial");
    MarshallingConfiguration configuration = new MarshallingConfiguration();
    configuration.setVersion(5);
    UnmarshallerProvider provider = new DefaultUnmarshallerProvider(factory, configuration);
    MarshallingDecoder decoder = new MarshallingDecoder(provider, 1024);
    return decoder;

}
项目:fileserver    文件:MarshallingCodeCFactory.java   
/**
    * 创建Jboss Marshalling解码器MarshallingDecoder
    * 
    * @return
    */
   public static MarshallingDecoder buildMarshallingDecoder() {
final MarshallerFactory marshallerFactory = Marshalling
    .getProvidedMarshallerFactory("serial");
final MarshallingConfiguration configuration = new MarshallingConfiguration();
configuration.setVersion(5);
UnmarshallerProvider provider = new DefaultUnmarshallerProvider(
    marshallerFactory, configuration);
MarshallingDecoder decoder = new MarshallingDecoder(provider, 1024*1024*10);
return decoder;
   }
项目:netty-book    文件:MarshallingCodeCFactory.java   
/**
    * 创建Jboss Marshalling解码器MarshallingDecoder
    * 
    * @return
    */
   public static MarshallingDecoder buildMarshallingDecoder() {
final MarshallerFactory marshallerFactory = Marshalling
    .getProvidedMarshallerFactory("serial");
final MarshallingConfiguration configuration = new MarshallingConfiguration();
configuration.setVersion(5);
UnmarshallerProvider provider = new DefaultUnmarshallerProvider(
    marshallerFactory, configuration);
MarshallingDecoder decoder = new MarshallingDecoder(provider, 1024);
return decoder;
   }
项目:javase-study    文件:MarshallingInitializer.java   
@Override
protected void initChannel(SocketChannel ch) throws Exception {
    ChannelPipeline pipeline = ch.pipeline();
    pipeline.addLast(new MarshallingDecoder(unmarshallerProvider));
    pipeline.addLast(new MarshallingEncoder(marshallerProvider));
    pipeline.addLast(new ObjectHandler());
}