本文整理汇总了Java中org.jboss.netty.handler.codec.frame.DelimiterBasedFrameDecoder类的典型用法代码示例。如果您正苦于以下问题:Java DelimiterBasedFrameDecoder类的具体用法?Java DelimiterBasedFrameDecoder怎么用?Java DelimiterBasedFrameDecoder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DelimiterBasedFrameDecoder类属于org.jboss.netty.handler.codec.frame包,在下文中一共展示了DelimiterBasedFrameDecoder类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getPipeline
import org.jboss.netty.handler.codec.frame.DelimiterBasedFrameDecoder; //导入依赖的package包/类
@Override
public ChannelPipeline getPipeline() throws Exception
{
ChannelPipeline pipeline = Channels.pipeline();
// Add the text line codec combination first,
DelimiterBasedFrameDecoder frameDecoder = new DelimiterBasedFrameDecoder(
maxCommandLength, Delimiters.lineDelimiter());
pipeline.addLast("framer", frameDecoder);
pipeline.addLast("decoder", new WordSplitter());
pipeline.addLast("encoder", new StringEncoder());
// and then business logic.
pipeline.addLast("handler", this);
return pipeline;
}
开发者ID:quqiangsheng,项目名称:abhot,代码行数:18,代码来源:TelnetServer.java
示例2: getPipeline
import org.jboss.netty.handler.codec.frame.DelimiterBasedFrameDecoder; //导入依赖的package包/类
@Override
public ChannelPipeline getPipeline() throws Exception
{
// Create a default pipeline implementation.
ChannelPipeline pipeline = pipeline();
// Add the text line codec combination first,
pipeline.addLast("framer", new DelimiterBasedFrameDecoder(3000000,
ChannelBuffers.wrappedBuffer(new byte[] {'E','O','F'})));
//pipeline.addLast("framer", new DelimiterBasedFrameDecoder(Integer.MAX_VALUE,
// Delimiters.lineDelimiter()));
//pipeline.addLast("eofFramer", new TextProtocolFrameDecoder());
pipeline.addLast("decoder", new StringDecoder());
pipeline.addLast("encoder", new StringEncoder());
// Insert OrderedMemoryAwareThreadPoolExecutor before your blocking handler
pipeline.addLast("pipelineExecutor", new ExecutionHandler(this.eventExecutor));
// and then business logic.
pipeline.addLast("handler", new TextProtocolHandler());
return pipeline;
}
开发者ID:ZalemSoftware,项目名称:OpenMobster,代码行数:25,代码来源:TextProtocolPipelineFactory.java
示例3: getPipelineFactory
import org.jboss.netty.handler.codec.frame.DelimiterBasedFrameDecoder; //导入依赖的package包/类
public ChannelPipelineFactory getPipelineFactory() {
executionHandler = new NaviExecutionHandler();
// execution = new ExecutionHandler(Executors.newCachedThreadPool());
return new ChannelPipelineFactory() {
public ChannelPipeline getPipeline() throws Exception {
ChannelPipeline pipeline = Channels.pipeline();
pipeline.addLast("idleState", new IdleStateHandler(timer,
getChildChannelIdleTime(), getChildChannelIdleTime(),
getChildChannelIdleTime()));
//StateCheckChannelHandler加入心跳机制 读空闲 断开连接 写空闲发送心跳数据
// pipeline.addLast("idleHandler", new StateCheckChannelHandler());
pipeline.addLast("decoder", new DelimiterBasedFrameDecoder(getMaxPacketSize(), getDelimiter()));
pipeline.addLast("execution", executionHandler);
// pipeline.addLast("execution", execution);
pipeline.addLast("handler", getNaviTCPHandler());
return pipeline;
}
};
}
开发者ID:sunguangran,项目名称:navi,代码行数:20,代码来源:NaviNettyTCPServer.java
示例4: initGps103Server
import org.jboss.netty.handler.codec.frame.DelimiterBasedFrameDecoder; //导入依赖的package包/类
private void initGps103Server(String protocol) throws SQLException {
if (isProtocolEnabled(properties, protocol)) {
serverList.add(new TrackerServer(this, new ServerBootstrap(), protocol) {
@Override
protected void addSpecificHandlers(ChannelPipeline pipeline) {
byte delimiter1[] = { (byte) '\r', (byte) '\n' };
byte delimiter2[] = { (byte) '\n' };
byte delimiter3[] = { (byte) ';' };
pipeline.addLast("frameDecoder", new DelimiterBasedFrameDecoder(1024,
ChannelBuffers.wrappedBuffer(delimiter1),
ChannelBuffers.wrappedBuffer(delimiter2),
ChannelBuffers.wrappedBuffer(delimiter3)));
pipeline.addLast("stringDecoder", new StringDecoder());
pipeline.addLast("stringEncoder", new StringEncoder());
pipeline.addLast("objectDecoder", new Gps103ProtocolDecoder(ServerManager.this));
}
});
}
}
开发者ID:michaelloliveira,项目名称:traccar-mongodb,代码行数:20,代码来源:ServerManager.java
示例5: initGl200Server
import org.jboss.netty.handler.codec.frame.DelimiterBasedFrameDecoder; //导入依赖的package包/类
private void initGl200Server(String protocol) throws SQLException {
if (isProtocolEnabled(properties, protocol)) {
serverList.add(new TrackerServer(this, new ServerBootstrap(), protocol) {
@Override
protected void addSpecificHandlers(ChannelPipeline pipeline) {
byte delimiter1[] = { (byte) '$' };
byte delimiter2[] = { (byte) '\0' };
pipeline.addLast("frameDecoder",
new DelimiterBasedFrameDecoder(1024,
ChannelBuffers.wrappedBuffer(delimiter1),
ChannelBuffers.wrappedBuffer(delimiter2)));
pipeline.addLast("stringDecoder", new StringDecoder());
pipeline.addLast("stringEncoder", new StringEncoder());
pipeline.addLast("objectDecoder", new Gl200ProtocolDecoder(ServerManager.this));
}
});
}
}
开发者ID:michaelloliveira,项目名称:traccar-mongodb,代码行数:19,代码来源:ServerManager.java
示例6: getPipeline
import org.jboss.netty.handler.codec.frame.DelimiterBasedFrameDecoder; //导入依赖的package包/类
@Override
public ChannelPipeline getPipeline() throws Exception
{
ChannelPipeline pipeline = Channels.pipeline();
// Add the text line codec combination first,
DelimiterBasedFrameDecoder frameDecoder = new DelimiterBasedFrameDecoder(
1024, Delimiters.lineDelimiter());
pipeline.addLast("framer", frameDecoder);
pipeline.addLast("decoder", new WordSplitter());
pipeline.addLast("encoder", new StringEncoder());
// and then business logic.
pipeline.addLast("handler", this);
return pipeline;
}
开发者ID:kairosdb,项目名称:kairos-carbon,代码行数:18,代码来源:CarbonTextServer.java
示例7: getPipeline
import org.jboss.netty.handler.codec.frame.DelimiterBasedFrameDecoder; //导入依赖的package包/类
@Override
public ChannelPipeline getPipeline() {
ChannelPipeline pipeline = Channels.pipeline();
// decoders
pipeline.addLast("framer", new DelimiterBasedFrameDecoder(MAX_REQUEST_LENGTH, DOUBLE_LINE_FEED_DELIMITER));
pipeline.addLast("string-decoder", new StringDecoder(JAGGRAB_CHARSET));
pipeline.addLast("jaggrab-decoder", new JagGrabRequestDecoder());
// encoders
pipeline.addLast("jaggrab-encoder", new JagGrabResponseEncoder());
// handler
pipeline.addLast("timeout", new IdleStateHandler(timer, NetworkConstants.IDLE_TIME, 0, 0));
pipeline.addLast("handler", handler);
return pipeline;
}
开发者ID:DealerNextDoor,项目名称:ApolloDev,代码行数:19,代码来源:JagGrabPipelineFactory.java
示例8: start
import org.jboss.netty.handler.codec.frame.DelimiterBasedFrameDecoder; //导入依赖的package包/类
private void start()
{
// Configure the server.
ServerBootstrap bootstrap = new ServerBootstrap(
new NioServerSocketChannelFactory(Executors.newCachedThreadPool(),
Executors.newCachedThreadPool()));
// Set up the pipeline factory to accept line delimited input.
bootstrap.setPipelineFactory(new ChannelPipelineFactory() {
@Override
public ChannelPipeline getPipeline() throws Exception
{
return Channels.pipeline(
new DelimiterBasedFrameDecoder(1024, Delimiters.lineDelimiter()),
new RetraceServerHandler());
}
});
// Bind and start to accept incoming connections.
InetSocketAddress address = new InetSocketAddress(host, port);
bootstrap.bind(address);
System.out.println("RetraceSrv listening on " + host + ":" + port);
}
开发者ID:redbooth,项目名称:retrace-server,代码行数:24,代码来源:RetraceServer.java
示例9: getPipeline
import org.jboss.netty.handler.codec.frame.DelimiterBasedFrameDecoder; //导入依赖的package包/类
@Override
public ChannelPipeline getPipeline() {
ChannelPipeline pipeline = Channels.pipeline();
pipeline.addLast("U-maintenanceHandler", maintenanceHandler);
pipeline.addLast("U-channels", nrtmChannelsRegistry);
pipeline.addLast("U-acl", aclHandler);
pipeline.addLast("U-delimiter", new DelimiterBasedFrameDecoder(128, true, LINE_DELIMITER));
pipeline.addLast("U-string-decoder", stringDecoder);
pipeline.addLast("D-string-encoder", stringEncoder);
pipeline.addLast("UD-execution", executionHandler);
pipeline.addLast("U-query-handler", new NrtmQueryHandler(serialDao, dummifier, clientSynchronisationScheduler, nrtmLog, version, source, updateInterval));
pipeline.addLast("U-exception-handler", exceptionHandler);
return pipeline;
}
开发者ID:RIPE-NCC,项目名称:whois,代码行数:21,代码来源:BaseNrtmServerPipelineFactory.java
示例10: start
import org.jboss.netty.handler.codec.frame.DelimiterBasedFrameDecoder; //导入依赖的package包/类
public void start() {
ExecutorService bossPool = Executors.newCachedThreadPool();
log.info("Creating worker thread pool with " + workers + " threads.");
ExecutorService workerPool = Executors.newFixedThreadPool(workers);
bootstrap = new ServerBootstrap(new NioServerSocketChannelFactory(bossPool, workerPool));
jmxRequestHandler = new JmxRequestHandler();
bootstrap.setPipelineFactory(new ChannelPipelineFactory() {
public ChannelPipeline getPipeline() throws Exception {
return Channels.pipeline(
new DelimiterBasedFrameDecoder(1024 * 1024, ChannelBuffers
.copiedBuffer("\n", CharsetUtil.UTF_8)), new StringDecoder(), new StringEncoder(),
jmxRequestHandler);
};
});
bootstrap.bind(listenAddress);
log.info("Starting listening to {}", listenAddress);
}
开发者ID:nlalevee,项目名称:jmx-daemon,代码行数:18,代码来源:JmxDaemon.java
示例11: getPipelineFactory
import org.jboss.netty.handler.codec.frame.DelimiterBasedFrameDecoder; //导入依赖的package包/类
public ChannelPipelineFactory getPipelineFactory() {
executionHandler = new NaviExecutionHandler();
return new ChannelPipelineFactory() {
public ChannelPipeline getPipeline() throws Exception {
ChannelPipeline pipeline = Channels.pipeline();
pipeline.addLast("decoder", new DelimiterBasedFrameDecoder(getMaxPacketSize(), getDelimiter()));
pipeline.addLast("execution", executionHandler);
pipeline.addLast("handler", getNaviUDPHandler());
return pipeline;
}
};
}
开发者ID:sunguangran,项目名称:navi,代码行数:13,代码来源:NaviNettyUDPServer.java
示例12: startup
import org.jboss.netty.handler.codec.frame.DelimiterBasedFrameDecoder; //导入依赖的package包/类
public void startup(){
try {
bossExecutor = Executors.newCachedThreadPool();
workerExecutor = Executors.newCachedThreadPool();
bootstrap = new ServerBootstrap(
new NioServerSocketChannelFactory(
bossExecutor,workerExecutor));
final NettyServerHandler nettyServerHandler = new NettyServerHandler();
// 设置一个处理客户端消息和各种消息事件的类(Handler)
bootstrap.setPipelineFactory(new ChannelPipelineFactory() {
@Override
public ChannelPipeline getPipeline() throws Exception {
ChannelPipeline pipeline = Channels.pipeline();
pipeline.addLast(
"decoder",
new DelimiterBasedFrameDecoder(Integer.MAX_VALUE,
false, true, ChannelBuffers.copiedBuffer(
delimiter,
Charset.forName(encoding))));
pipeline.addLast("handler", nettyServerHandler);
return pipeline;
}
});
bootstrap.setOption("child.receiveBufferSize", receiveBufferSize);
bootstrap.setOption("child.keepAlive", true);
// bootstrap.setOption("child.tcpNoDelay", true);
bootstrap.bind(new InetSocketAddress(InetAddress.getByName(host),
port));
logger.warn("netty server start up success port:{}.", port);
} catch (Exception e) {
logger.error(e.getMessage());
System.exit(1);
}
}
开发者ID:DTStack,项目名称:jlogstash-input-plugin,代码行数:35,代码来源:NettyRev.java
示例13: emit
import org.jboss.netty.handler.codec.frame.DelimiterBasedFrameDecoder; //导入依赖的package包/类
@Override
public void emit() {
// TODO Auto-generated method stub
// Server服务启动器
try {
bossExecutor = Executors.newCachedThreadPool();
workerExecutor = Executors.newCachedThreadPool();
bootstrap = new ServerBootstrap(
new NioServerSocketChannelFactory(
bossExecutor,workerExecutor));
final NettyServerHandler nettyServerHandler = new NettyServerHandler(
this);
// 设置一个处理客户端消息和各种消息事件的类(Handler)
bootstrap.setPipelineFactory(new ChannelPipelineFactory() {
@Override
public ChannelPipeline getPipeline() throws Exception {
ChannelPipeline pipeline = Channels.pipeline();
if(isExtract){
pipeline.addLast("zlibDecoder", new ZlibDecoder(ZlibWrapper.GZIP));
}
pipeline.addLast(
"decoder",
new DelimiterBasedFrameDecoder(Integer.MAX_VALUE,
false, true, ChannelBuffers.copiedBuffer(
delimiter,
Charset.forName(encoding))));
pipeline.addLast("handler", nettyServerHandler);
return pipeline;
}
});
bootstrap.setOption("child.receiveBufferSize", receiveBufferSize);
bootstrap.setOption("child.keepAlive", true);
bootstrap.setOption("child.tcpNoDelay", true);
bootstrap.bind(new InetSocketAddress(InetAddress.getByName(host),
port));
} catch (Exception e) {
logger.error(e.getMessage());
System.exit(1);
}
}
开发者ID:DTStack,项目名称:jlogstash-input-plugin,代码行数:41,代码来源:Netty.java
示例14: newDelimiterBasedFrameDecoder
import org.jboss.netty.handler.codec.frame.DelimiterBasedFrameDecoder; //导入依赖的package包/类
public static ChannelHandlerFactory newDelimiterBasedFrameDecoder(final int maxFrameLength, final ChannelBuffer[] delimiters) {
return new ChannelHandlerFactory() {
@Override
public ChannelHandler newChannelHandler() {
return new DelimiterBasedFrameDecoder(maxFrameLength, true, delimiters);
}
};
}
开发者ID:HydAu,项目名称:Camel,代码行数:9,代码来源:ChannelHandlerFactories.java
示例15: getPipeline
import org.jboss.netty.handler.codec.frame.DelimiterBasedFrameDecoder; //导入依赖的package包/类
@Override
public ChannelPipeline getPipeline() throws Exception {
clientInvoked = true;
ChannelPipeline channelPipeline = Channels.pipeline();
channelPipeline.addLast("decoder-DELIM", new DelimiterBasedFrameDecoder(maxLineSize, true, Delimiters.lineDelimiter()));
channelPipeline.addLast("decoder-SD", new StringDecoder(CharsetUtil.UTF_8));
channelPipeline.addLast("encoder-SD", new StringEncoder(CharsetUtil.UTF_8));
channelPipeline.addLast("handler", new ClientChannelHandler(producer));
return channelPipeline;
}
开发者ID:HydAu,项目名称:Camel,代码行数:14,代码来源:NettyCustomPipelineFactorySynchTest.java
示例16: getPipeline
import org.jboss.netty.handler.codec.frame.DelimiterBasedFrameDecoder; //导入依赖的package包/类
public ChannelPipeline getPipeline() {
ChannelPipeline pipeline = Channels.pipeline();
pipeline.addLast("idleTimer",idleStateHandler);
pipeline.addLast("idleHandler",myIdleHandler);
pipeline.addLast("framer", new DelimiterBasedFrameDecoder(
1024, Delimiters.lineDelimiter()));
pipeline.addLast("stringDecoder", TcpMeta.stringDecoder);
pipeline.addLast("stringEncoder", TcpMeta.stringEncoder);
pipeline.addLast("handler",
new TcpChannelHandler(tcpWorker));
return pipeline;
}
开发者ID:eBay,项目名称:parallec,代码行数:15,代码来源:TcpWorker.java
示例17: getPipeline
import org.jboss.netty.handler.codec.frame.DelimiterBasedFrameDecoder; //导入依赖的package包/类
public ChannelPipeline getPipeline() throws Exception {
this.channelPipeline = pipeline();
this.handler = new Handler(this.clientBootstrap, this.timer, this.reconnectTimeout);
this.channelPipeline.addLast("framer", new DelimiterBasedFrameDecoder(8192, Delimiters.lineDelimiter()));
this.channelPipeline.addLast("decoder", new StringDecoder());
this.channelPipeline.addLast("encoder", new StringEncoder());
this.channelPipeline.addLast("handler", handler);
return this.channelPipeline;
}
开发者ID:Buck2k,项目名称:cellhealth-ng,代码行数:10,代码来源:Pipeline.java
示例18: getPipeline
import org.jboss.netty.handler.codec.frame.DelimiterBasedFrameDecoder; //导入依赖的package包/类
public ChannelPipeline getPipeline() throws Exception {
ChannelPipeline pipeline = pipeline();
pipeline.addLast("framer", new DelimiterBasedFrameDecoder(8192, Delimiters.lineDelimiter()));
pipeline.addLast("decoder", new StringDecoder());
pipeline.addLast("encoder", new StringEncoder());
pipeline.addLast("handler", new NettyTCPWriterHandler(this.bootstrap, this.channel, this.timer));
return pipeline;
}
开发者ID:Nordstrom,项目名称:vmstats,代码行数:9,代码来源:NettyTCPWriterPipelineFactory.java
示例19: getPipeline
import org.jboss.netty.handler.codec.frame.DelimiterBasedFrameDecoder; //导入依赖的package包/类
public ChannelPipeline getPipeline() throws Exception {
// this is pretty verbose from the netty examples
ChannelPipeline pipeline = Channels.pipeline();
pipeline.addLast("framer", new DelimiterBasedFrameDecoder(8192, Delimiters.lineDelimiter()));
pipeline.addLast("decoder", new StringDecoder());
pipeline.addLast("encoder", new StringEncoder());
pipeline.addLast("handler", new FakeCarbonHandler(appConfig));
return pipeline;
}
开发者ID:Nordstrom,项目名称:vmstats,代码行数:10,代码来源:FakeCarbonPipelineFactory.java
示例20: getPipeline
import org.jboss.netty.handler.codec.frame.DelimiterBasedFrameDecoder; //导入依赖的package包/类
public ChannelPipeline getPipeline() throws Exception {
ChannelPipeline pipeline = Channels.pipeline();
boolean stripDelimiter = true;
pipeline.addLast("framer", new DelimiterBasedFrameDecoder(
DEFAULT_FRAME_SIZE,
stripDelimiter,
Delimiters.nulDelimiter()));
pipeline.addLast("decoder", _stringFreelingDecoder);
pipeline.addLast("encoder", _stringFreelingEncoder); // encode to freeling
pipeline.addLast("handler", new MultiLineBasedClientHandler(_socketBolt));
return pipeline;
}
开发者ID:danigiri,项目名称:storm-freeling,代码行数:15,代码来源:FreelingPipelineFactory.java
注:本文中的org.jboss.netty.handler.codec.frame.DelimiterBasedFrameDecoder类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论