本文整理汇总了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));
}
});
}
示例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));
}
});
}
示例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;
}
示例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;
}
示例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);
}
示例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));
}
});
}
}
示例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));
}
});
}
}
示例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;
}
示例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);
}
示例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));
}
});
}
示例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));
}
});
}
示例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));
}
});
}
示例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));
}
});
}
示例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));
}
});
}
示例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));
}
});
}