當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。