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


Java FrameDecoder类代码示例

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


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

示例1: start

import org.jboss.netty.handler.codec.frame.FrameDecoder; //导入依赖的package包/类
private static TCPServer start(int port, final ChannelUpstreamHandler serverHandler, final FrameDecoder decoder,
        final ChannelDownstreamHandler encoder, final boolean nio) {
    TCPServer server = new TCPServer(port);
    server.bootstrap = new ServerBootstrap( getChannelFactory(nio) );
    // Set up the pipeline factory.
    server.bootstrap.setPipelineFactory(new ChannelPipelineFactory() {
        public ChannelPipeline getPipeline() throws Exception {
            return Channels.pipeline(
                    decoder,
                    encoder,
                    serverHandler);
        }
    });

    // Bind and start to accept incoming connections.
    server.channel = server.bootstrap.bind(new InetSocketAddress(port));
    return server;
}
 
开发者ID:viant,项目名称:CacheStore,代码行数:19,代码来源:TCPServer.java

示例2: start

import org.jboss.netty.handler.codec.frame.FrameDecoder; //导入依赖的package包/类
private static TCPClient start(String host, int port, final ChannelUpstreamHandler clientHandler, final ChannelDownstreamHandler encoder,
                          final FrameDecoder decoder, boolean nio){
    TCPClient client = new TCPClient(host, port);
    client.clientHandler= clientHandler;
    // Configure the client.
    client.bootstrap = new ClientBootstrap( getClientSocketChannelFactory(nio));
    // Set up the pipeline factory.
    client.bootstrap.setPipelineFactory(new ChannelPipelineFactory() {
        public ChannelPipeline getPipeline() throws Exception {
            return Channels.pipeline(
                    encoder,
                    decoder,
                    clientHandler);
        }
    });

    // Start the connection attempt.
    client.future = client.bootstrap.connect(new InetSocketAddress(host, port));
    if (client.getFuture().awaitUninterruptibly(TIME_OUT) && client.getFuture().getChannel().isConnected())
        return client ; //logger.info("wait ok");
    else {
        client.future.getChannel().close();
        client.bootstrap.releaseExternalResources();
        throw new ConnectionException("not able to connect "+ client.toString());
    }

}
 
开发者ID:viant,项目名称:CacheStore,代码行数:28,代码来源:TCPClient.java

示例3: constructRpcFrameDecoder

import org.jboss.netty.handler.codec.frame.FrameDecoder; //导入依赖的package包/类
public static FrameDecoder constructRpcFrameDecoder() {
  return new RpcFrameDecoder();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:4,代码来源:RpcUtil.java

示例4: startOio

import org.jboss.netty.handler.codec.frame.FrameDecoder; //导入依赖的package包/类
/**
 * decoder must be thread safe, other wise data corruption
 * @param port
 * @param serverHandler
 * @param decoder
 * @param encoder
 * @return
 */
public static TCPServer startOio(int port, final ChannelUpstreamHandler serverHandler, final FrameDecoder decoder,
                                 final ChannelDownstreamHandler encoder) {
    return start(port, serverHandler, decoder, encoder, false);

}
 
开发者ID:viant,项目名称:CacheStore,代码行数:14,代码来源:TCPServer.java

示例5: startOio

import org.jboss.netty.handler.codec.frame.FrameDecoder; //导入依赖的package包/类
/**
 *
 * @param host
 * @param port
 * @param clientHandler
 * @param encoder
 * @param decoder must be thread safe
 * @return
 */
public static TCPClient startOio(String host, int port, final ChannelUpstreamHandler clientHandler, final ChannelDownstreamHandler encoder,
                              final FrameDecoder decoder){
    return start( host, port, clientHandler, encoder, decoder, false);


}
 
开发者ID:viant,项目名称:CacheStore,代码行数:16,代码来源:TCPClient.java


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