当前位置: 首页>>代码示例>>Java>>正文


Java ChannelOutboundHandler类代码示例

本文整理汇总了Java中io.netty.channel.ChannelOutboundHandler的典型用法代码示例。如果您正苦于以下问题:Java ChannelOutboundHandler类的具体用法?Java ChannelOutboundHandler怎么用?Java ChannelOutboundHandler使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ChannelOutboundHandler类属于io.netty.channel包,在下文中一共展示了ChannelOutboundHandler类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: newEncoder

import io.netty.channel.ChannelOutboundHandler; //导入依赖的package包/类
@Override
public ChannelOutboundHandler newEncoder() {
	return new MessageToByteEncoder<byte[]>() {

		@Override
		protected void encode(ChannelHandlerContext ctx, byte[] msg,
				ByteBuf out) throws Exception {
			out.writeBytes(msg);
		}
		
	};
}
 
开发者ID:leo27lijiang,项目名称:remote-netty,代码行数:13,代码来源:FileServer.java

示例2: newEncoder

import io.netty.channel.ChannelOutboundHandler; //导入依赖的package包/类
@Override
public ChannelOutboundHandler newEncoder() {
	return new MessageToByteEncoder<ByteBean>() {

		@Override
		protected void encode(ChannelHandlerContext ctx, ByteBean msg,
				ByteBuf out) throws Exception {
			out.writeBytes(msg.getContent(), msg.getPosition(), msg.getLength());
		}
		
	};
}
 
开发者ID:leo27lijiang,项目名称:remote-netty,代码行数:13,代码来源:FileClient.java

示例3: encoder

import io.netty.channel.ChannelOutboundHandler; //导入依赖的package包/类
public ChannelOutboundHandler encoder() {
    return encoder;
}
 
开发者ID:hekate-io,项目名称:hekate,代码行数:4,代码来源:NetworkProtocolCodec.java

示例4: newEncoder

import io.netty.channel.ChannelOutboundHandler; //导入依赖的package包/类
@Override
public ChannelOutboundHandler newEncoder() {
	return new DefaultByteArrayEncoderHandler();
}
 
开发者ID:leo27lijiang,项目名称:remote-netty,代码行数:5,代码来源:ChannelHandlerFactoryAdapter.java

示例5: newEncoder

import io.netty.channel.ChannelOutboundHandler; //导入依赖的package包/类
@Override
public ChannelOutboundHandler newEncoder() {
	return new ChannelEncoder();
}
 
开发者ID:leo27lijiang,项目名称:app-monitor,代码行数:5,代码来源:NetHandlerFactory.java

示例6: addHandler

import io.netty.channel.ChannelOutboundHandler; //导入依赖的package包/类
/**
 * Add a {@link ChannelHandler} with {@link #addHandlerFirst} if of type of
 * {@link io.netty.channel.ChannelOutboundHandler} otherwise with
 * {@link #addHandlerLast}. Implementation may add more auto handling in particular
 * HTTP based context will prepend an HttpContent body extractor.
 * <p>
 * {@code [ [reactor codecs], [<- user FIRST HANDLERS added here, user LAST HANDLERS added here ->], [reactor handlers] ]}
 * <p>
 * If effectively added, the handler will be safely removed when the channel is made
 * inactive (pool release).
 *
 * @param name handler name
 * @param handler handler instance
 *
 * @return this NettyContext
 */
default NettyContext addHandler(String name, ChannelHandler handler){
	if(handler instanceof ChannelOutboundHandler){
		addHandlerFirst(name, handler);
	}
	else {
		addHandlerLast(name, handler);
	}
	return this;
}
 
开发者ID:reactor,项目名称:reactor-netty,代码行数:26,代码来源:NettyContext.java

示例7: newEncoder

import io.netty.channel.ChannelOutboundHandler; //导入依赖的package包/类
/**
 * 创建编码器句柄
 * @return
 */
public ChannelOutboundHandler newEncoder();
 
开发者ID:leo27lijiang,项目名称:remote-netty,代码行数:6,代码来源:ChannelHandlerFactory.java


注:本文中的io.netty.channel.ChannelOutboundHandler类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。