本文整理汇总了Java中org.jboss.netty.handler.codec.string.StringEncoder类的典型用法代码示例。如果您正苦于以下问题:Java StringEncoder类的具体用法?Java StringEncoder怎么用?Java StringEncoder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StringEncoder类属于org.jboss.netty.handler.codec.string包,在下文中一共展示了StringEncoder类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: initTrackerServers
import org.jboss.netty.handler.codec.string.StringEncoder; //导入依赖的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.StringEncoder; //导入依赖的package包/类
@Override
public void initTrackerServers(List<TrackerServer> serverList) {
TrackerServer server = new TrackerServer(new ServerBootstrap(), getName()) {
@Override
protected void addSpecificHandlers(ChannelPipeline pipeline) {
pipeline.addLast("frameDecoder", new MeitrackFrameDecoder());
pipeline.addLast("stringEncoder", new StringEncoder());
pipeline.addLast("objectEncoder", new MeitrackProtocolEncoder());
pipeline.addLast("objectDecoder", new MeitrackProtocolDecoder(MeitrackProtocol.this));
}
};
server.setEndianness(ByteOrder.LITTLE_ENDIAN);
serverList.add(server);
server = new TrackerServer(new ConnectionlessBootstrap(), getName()) {
@Override
protected void addSpecificHandlers(ChannelPipeline pipeline) {
pipeline.addLast("stringEncoder", new StringEncoder());
pipeline.addLast("objectEncoder", new MeitrackProtocolEncoder());
pipeline.addLast("objectDecoder", new MeitrackProtocolDecoder(MeitrackProtocol.this));
}
};
server.setEndianness(ByteOrder.LITTLE_ENDIAN);
serverList.add(server);
}
开发者ID:bamartinezd,项目名称:traccar-service,代码行数:25,代码来源:MeitrackProtocol.java
示例3: initTrackerServers
import org.jboss.netty.handler.codec.string.StringEncoder; //导入依赖的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
示例4: getPipeline
import org.jboss.netty.handler.codec.string.StringEncoder; //导入依赖的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
示例5: getPipeline
import org.jboss.netty.handler.codec.string.StringEncoder; //导入依赖的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
示例6: start
import org.jboss.netty.handler.codec.string.StringEncoder; //导入依赖的package包/类
@Override
public void start() {
org.jboss.netty.channel.ChannelFactory factory = new NioServerSocketChannelFactory(
Executors.newCachedThreadPool(), Executors.newCachedThreadPool());
ServerBootstrap serverBootstrap = new ServerBootstrap(factory);
serverBootstrap.setPipelineFactory(new ChannelPipelineFactory() {
@Override
public ChannelPipeline getPipeline() {
EventHandler handler = new EventHandler();
final ChannelPipeline pipeline = Channels.pipeline(handler);
pipeline.addFirst("decoder", new LineBasedFrameDecoder(1024));
pipeline.addLast("encoder", new StringEncoder(Charsets.UTF_8));
return pipeline;
}
});
logger.info("OpenTSDB Source starting...");
if (host == null) {
nettyChannel = serverBootstrap.bind(new InetSocketAddress(port));
} else {
nettyChannel = serverBootstrap.bind(new InetSocketAddress(host, port));
}
super.start();
}
开发者ID:yandex,项目名称:opentsdb-flume,代码行数:27,代码来源:OpenTSDBSource.java
示例7: createRegistry
import org.jboss.netty.handler.codec.string.StringEncoder; //导入依赖的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
示例8: initServer
import org.jboss.netty.handler.codec.string.StringEncoder; //导入依赖的package包/类
/**
* Start WebImageViewer.
* @param fsimage the fsimage to load.
* @throws IOException if fail to load the fsimage.
*/
@VisibleForTesting
public void initServer(String fsimage) throws IOException {
FSImageLoader loader = FSImageLoader.load(fsimage);
ChannelPipeline pipeline = Channels.pipeline();
pipeline.addLast("channelTracker", new SimpleChannelUpstreamHandler() {
@Override
public void channelOpen(ChannelHandlerContext ctx, ChannelStateEvent e)
throws Exception {
allChannels.add(e.getChannel());
}
});
pipeline.addLast("httpDecoder", new HttpRequestDecoder());
pipeline.addLast("requestHandler", new FSImageHandler(loader));
pipeline.addLast("stringEncoder", new StringEncoder());
pipeline.addLast("httpEncoder", new HttpResponseEncoder());
bootstrap.setPipeline(pipeline);
channel = bootstrap.bind(address);
allChannels.add(channel);
address = (InetSocketAddress) channel.getLocalAddress();
LOG.info("WebImageViewer started. Listening on " + address.toString()
+ ". Press Ctrl+C to stop the viewer.");
}
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:30,代码来源:WebImageViewer.java
示例9: start
import org.jboss.netty.handler.codec.string.StringEncoder; //导入依赖的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
示例10: initGps103Server
import org.jboss.netty.handler.codec.string.StringEncoder; //导入依赖的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
示例11: initGl200Server
import org.jboss.netty.handler.codec.string.StringEncoder; //导入依赖的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
示例12: getPipeline
import org.jboss.netty.handler.codec.string.StringEncoder; //导入依赖的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
示例13: start
import org.jboss.netty.handler.codec.string.StringEncoder; //导入依赖的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
示例14: sendDataCommand
import org.jboss.netty.handler.codec.string.StringEncoder; //导入依赖的package包/类
@Override
public void sendDataCommand(ActiveDevice activeDevice, Command command) {
if (supportedDataCommands.contains(command.getType())) {
activeDevice.write(command);
} else if (command.getType().equals(Command.TYPE_CUSTOM)) {
String data = command.getString(Command.KEY_DATA);
if (activeDevice.getChannel().getPipeline().get(StringEncoder.class) != null) {
activeDevice.write(data);
} else {
activeDevice.write(ChannelBuffers.wrappedBuffer(DatatypeConverter.parseHexBinary(data)));
}
} else {
throw new RuntimeException("Command " + command.getType() + " is not supported in protocol " + getName());
}
}
开发者ID:bamartinezd,项目名称:traccar-service,代码行数:16,代码来源:BaseProtocol.java
示例15: initTrackerServers
import org.jboss.netty.handler.codec.string.StringEncoder; //导入依赖的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
示例16: initTrackerServers
import org.jboss.netty.handler.codec.string.StringEncoder; //导入依赖的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
示例17: initTrackerServers
import org.jboss.netty.handler.codec.string.StringEncoder; //导入依赖的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
示例18: initTrackerServers
import org.jboss.netty.handler.codec.string.StringEncoder; //导入依赖的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 Jt600FrameDecoder());
pipeline.addLast("stringEncoder", new StringEncoder());
pipeline.addLast("objectEncoder", new Jt600ProtocolEncoder());
pipeline.addLast("objectDecoder", new Jt600ProtocolDecoder(Jt600Protocol.this));
}
});
}
开发者ID:bamartinezd,项目名称:traccar-service,代码行数:13,代码来源:Jt600Protocol.java
示例19: initTrackerServers
import org.jboss.netty.handler.codec.string.StringEncoder; //导入依赖的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
示例20: initTrackerServers
import org.jboss.netty.handler.codec.string.StringEncoder; //导入依赖的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
注:本文中的org.jboss.netty.handler.codec.string.StringEncoder类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论