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


Java StringDecoder类代码示例

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


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

示例1: initTrackerServers

import org.jboss.netty.handler.codec.string.StringDecoder; //导入依赖的package包/类
@Override
public void initTrackerServers(List<TrackerServer> serverList) {
    serverList.add(new TrackerServer(new ServerBootstrap(), getName()) {
        @Override
        protected void addSpecificHandlers(ChannelPipeline pipeline) {
            boolean full = Context.getConfig().getBoolean(getName() + ".extended");
            if (full) {
                pipeline.addLast("frameDecoder", new LineBasedFrameDecoder(1024)); // tracker bug \n\r
            } else {
                pipeline.addLast("frameDecoder", new XexunFrameDecoder());
            }
            pipeline.addLast("stringEncoder", new StringEncoder());
            pipeline.addLast("stringDecoder", new StringDecoder());
            pipeline.addLast("objectEncoder", new XexunProtocolEncoder());
            pipeline.addLast("objectDecoder", new XexunProtocolDecoder(XexunProtocol.this, full));
        }
    });
}
 
开发者ID:bamartinezd,项目名称:traccar-service,代码行数:19,代码来源:XexunProtocol.java

示例2: initTrackerServers

import org.jboss.netty.handler.codec.string.StringDecoder; //导入依赖的package包/类
@Override
public void initTrackerServers(List<TrackerServer> serverList) {
    serverList.add(new TrackerServer(new ServerBootstrap(), getName()) {
        @Override
        protected void addSpecificHandlers(ChannelPipeline pipeline) {
            pipeline.addLast("frameDecoder", new LineBasedFrameDecoder(4 * 1024));
            pipeline.addLast("stringEncoder", new StringEncoder());
            boolean utf8 = Context.getConfig().getBoolean(getName() + ".utf8");
            if (utf8) {
                pipeline.addLast("stringDecoder", new StringDecoder(StandardCharsets.UTF_8));
            } else {
                pipeline.addLast("stringDecoder", new StringDecoder());
            }
            pipeline.addLast("objectEncoder", new WialonProtocolEncoder());
            pipeline.addLast("objectDecoder", new WialonProtocolDecoder(WialonProtocol.this));
        }
    });
}
 
开发者ID:bamartinezd,项目名称:traccar-service,代码行数:19,代码来源:WialonProtocol.java

示例3: getPipeline

import org.jboss.netty.handler.codec.string.StringDecoder; //导入依赖的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

示例4: createRegistry

import org.jboss.netty.handler.codec.string.StringDecoder; //导入依赖的package包/类
@Override
protected JndiRegistry createRegistry() throws Exception {
    JndiRegistry registry = super.createRegistry();
    
    // setup the String encoder and decoder 
   
    StringDecoder stringDecoder = new StringDecoder();
    registry.bind("string-decoder", stringDecoder);

    StringEncoder stringEncoder = new StringEncoder();
    registry.bind("string-encoder", stringEncoder);

    List<ChannelHandler> decoders = new ArrayList<ChannelHandler>();
    decoders.add(stringDecoder);

    List<ChannelHandler> encoders = new ArrayList<ChannelHandler>();
    encoders.add(stringEncoder);

    registry.bind("encoders", encoders);
    registry.bind("decoders", decoders);
    
    return registry;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:24,代码来源:NettyHttpGetWithInvalidMessageTest.java

示例5: start

import org.jboss.netty.handler.codec.string.StringDecoder; //导入依赖的package包/类
public void start(int listenPort, final ExecutorService threadPool, final long timeout) throws Exception {
	if (!startFlag.compareAndSet(false, true)) {
		return;
	}
	bootstrap.setPipelineFactory(new ChannelPipelineFactory() {
		public ChannelPipeline getPipeline() throws Exception {
			ChannelPipeline pipeline = new DefaultChannelPipeline();
			pipeline.addLast("decoder", new StringDecoder());
			pipeline.addLast("encoder", new StringEncoder());
			pipeline.addLast("handler", new NettyServerHandler(threadPool, timeout));
			return pipeline;
		}
	});
	bootstrap.bind(new InetSocketAddress(listenPort));
	log.warn("Server started,listen at: " + listenPort);
}
 
开发者ID:liuxinglanyue,项目名称:migration-tool,代码行数:17,代码来源:NettyServer.java

示例6: initGps103Server

import org.jboss.netty.handler.codec.string.StringDecoder; //导入依赖的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

示例7: initGl200Server

import org.jboss.netty.handler.codec.string.StringDecoder; //导入依赖的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

示例8: getPipeline

import org.jboss.netty.handler.codec.string.StringDecoder; //导入依赖的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

示例9: start

import org.jboss.netty.handler.codec.string.StringDecoder; //导入依赖的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

示例10: initTrackerServers

import org.jboss.netty.handler.codec.string.StringDecoder; //导入依赖的package包/类
@Override
public void initTrackerServers(List<TrackerServer> serverList) {
    serverList.add(new TrackerServer(new ServerBootstrap(), getName()) {
        @Override
        protected void addSpecificHandlers(ChannelPipeline pipeline) {
            pipeline.addLast("frameDecoder", new CharacterDelimiterFrameDecoder(1024, ')'));
            pipeline.addLast("stringDecoder", new StringDecoder());
            pipeline.addLast("stringEncoder", new StringEncoder());
            pipeline.addLast("objectDecoder", new TopflytechProtocolDecoder(TopflytechProtocol.this));
        }
    });
}
 
开发者ID:bamartinezd,项目名称:traccar-service,代码行数:13,代码来源:TopflytechProtocol.java

示例11: initTrackerServers

import org.jboss.netty.handler.codec.string.StringDecoder; //导入依赖的package包/类
@Override
public void initTrackerServers(List<TrackerServer> serverList) {
    serverList.add(new TrackerServer(new ServerBootstrap(), getName()) {
        @Override
        protected void addSpecificHandlers(ChannelPipeline pipeline) {
            pipeline.addLast("frameDecoder", new CharacterDelimiterFrameDecoder(1024, '!'));
            pipeline.addLast("stringEncoder", new StringEncoder());
            pipeline.addLast("stringDecoder", new StringDecoder());
            pipeline.addLast("objectDecoder", new GlobalSatProtocolDecoder(GlobalSatProtocol.this));
        }
    });
}
 
开发者ID:bamartinezd,项目名称:traccar-service,代码行数:13,代码来源:GlobalSatProtocol.java

示例12: initTrackerServers

import org.jboss.netty.handler.codec.string.StringDecoder; //导入依赖的package包/类
@Override
public void initTrackerServers(List<TrackerServer> serverList) {
    serverList.add(new TrackerServer(new ServerBootstrap(), getName()) {
        @Override
        protected void addSpecificHandlers(ChannelPipeline pipeline) {
            pipeline.addLast("frameDecoder", new CharacterDelimiterFrameDecoder(1024, ';'));
            pipeline.addLast("stringEncoder", new StringEncoder());
            pipeline.addLast("stringDecoder", new StringDecoder());
            pipeline.addLast("objectEncoder", new MiniFinderProtocolEncoder());
            pipeline.addLast("objectDecoder", new MiniFinderProtocolDecoder(MiniFinderProtocol.this));
        }
    });
}
 
开发者ID:bamartinezd,项目名称:traccar-service,代码行数:14,代码来源:MiniFinderProtocol.java

示例13: initTrackerServers

import org.jboss.netty.handler.codec.string.StringDecoder; //导入依赖的package包/类
@Override
public void initTrackerServers(List<TrackerServer> serverList) {
    serverList.add(new TrackerServer(new ServerBootstrap(), getName()) {
        @Override
        protected void addSpecificHandlers(ChannelPipeline pipeline) {
            pipeline.addLast("frameDecoder", new CharacterDelimiterFrameDecoder(1024, "\0", "\n", "\r\n"));
            pipeline.addLast("stringEncoder", new StringEncoder());
            pipeline.addLast("stringDecoder", new StringDecoder());
            pipeline.addLast("objectDecoder", new GpsGateProtocolDecoder(GpsGateProtocol.this));
        }
    });
}
 
开发者ID:bamartinezd,项目名称:traccar-service,代码行数:13,代码来源:GpsGateProtocol.java

示例14: initTrackerServers

import org.jboss.netty.handler.codec.string.StringDecoder; //导入依赖的package包/类
@Override
public void initTrackerServers(List<TrackerServer> serverList) {
    serverList.add(new TrackerServer(new ServerBootstrap(), getName()) {
        @Override
        protected void addSpecificHandlers(ChannelPipeline pipeline) {
            pipeline.addLast("frameDecoder", new CharacterDelimiterFrameDecoder(1024, '^'));
            pipeline.addLast("stringEncoder", new StringEncoder());
            pipeline.addLast("stringDecoder", new StringDecoder());
            pipeline.addLast("objectDecoder", new CarscopProtocolDecoder(CarscopProtocol.this));
        }
    });
}
 
开发者ID:bamartinezd,项目名称:traccar-service,代码行数:13,代码来源:CarscopProtocol.java

示例15: initTrackerServers

import org.jboss.netty.handler.codec.string.StringDecoder; //导入依赖的package包/类
@Override
public void initTrackerServers(List<TrackerServer> serverList) {
    serverList.add(new TrackerServer(new ServerBootstrap(), getName()) {
        @Override
        protected void addSpecificHandlers(ChannelPipeline pipeline) {
            pipeline.addLast("frameDecoder", new LineBasedFrameDecoder(1024));
            pipeline.addLast("stringEncoder", new StringEncoder());
            pipeline.addLast("stringDecoder", new StringDecoder());
            pipeline.addLast("objectDecoder", new Tr20ProtocolDecoder(Tr20Protocol.this));
        }
    });
}
 
开发者ID:bamartinezd,项目名称:traccar-service,代码行数:13,代码来源:Tr20Protocol.java


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