本文整理匯總了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;
}
示例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());
}
}
示例3: constructRpcFrameDecoder
import org.jboss.netty.handler.codec.frame.FrameDecoder; //導入依賴的package包/類
public static FrameDecoder constructRpcFrameDecoder() {
return new RpcFrameDecoder();
}
示例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);
}
示例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);
}