當前位置: 首頁>>代碼示例>>Java>>正文


Java MessageToMessageDecoder類代碼示例

本文整理匯總了Java中io.netty.handler.codec.MessageToMessageDecoder的典型用法代碼示例。如果您正苦於以下問題:Java MessageToMessageDecoder類的具體用法?Java MessageToMessageDecoder怎麽用?Java MessageToMessageDecoder使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


MessageToMessageDecoder類屬於io.netty.handler.codec包,在下文中一共展示了MessageToMessageDecoder類的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: injectNetty

import io.netty.handler.codec.MessageToMessageDecoder; //導入依賴的package包/類
public static void injectNetty(final Player player) {
    try {
        Object handle = player.getClass().getMethod("getHandle").invoke(player);
        Object playerConnection = handle.getClass().getField("playerConnection").get(handle);
        final Channel channel = (Channel) channelField.get(playerConnection.getClass().getField("networkManager").get(playerConnection));
        if (channel != null) {
            channel.pipeline().addAfter("decoder", "update_sign", new MessageToMessageDecoder<Object>() {
                @Override
                protected void decode(ChannelHandlerContext channelHandlerContext, Object object, List list) throws Exception {
                    if (object.toString().contains("PacketPlayInUpdateSign")) {
                        Object packet = ReflectionUtil.getNMSClass("PacketPlayInUpdateSign").cast(object);
                        Bukkit.getPluginManager().callEvent(new PlayerInputEvent(player, (String[]) packet.getClass().getMethod("b").invoke(packet)));
                    }
                    list.add(object);
                }
            });
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
開發者ID:ConnorLinfoot,項目名稱:CratesPlus,代碼行數:22,代碼來源:SignInputHandler.java

示例2: callDecode

import io.netty.handler.codec.MessageToMessageDecoder; //導入依賴的package包/類
public static List<Object> callDecode(MessageToMessageDecoder decoder, ChannelHandlerContext ctx, ByteBuf input) throws InvocationTargetException {
    List<Object> output = new ArrayList<>();
    try {
        BungeePipelineUtil.DECODE_METHOD.invoke(decoder, ctx, input, output);
    } catch (IllegalAccessException e) {
        e.printStackTrace();
    }
    return output;
}
 
開發者ID:MylesIsCool,項目名稱:ViaVersion,代碼行數:10,代碼來源:BungeePipelineUtil.java

示例3: decompress

import io.netty.handler.codec.MessageToMessageDecoder; //導入依賴的package包/類
public static ByteBuf decompress(ChannelHandlerContext ctx, ByteBuf bytebuf) {
    try {
        return (ByteBuf) callDecode((MessageToMessageDecoder) ctx.pipeline().get("decompress"), ctx.pipeline().context("decompress"), bytebuf).get(0);
    } catch (InvocationTargetException e) {
        e.printStackTrace();
        return ctx.alloc().buffer();
    }
}
 
開發者ID:MylesIsCool,項目名稱:ViaVersion,代碼行數:9,代碼來源:BungeePipelineUtil.java

示例4: CryptoFunction

import io.netty.handler.codec.MessageToMessageDecoder; //導入依賴的package包/類
public CryptoFunction(byte[] key, MessageToMessageEncoder<ByteBuf> encoder, MessageToMessageDecoder<ByteBuf> decoder) {

        this.key = key;
        this.encoder = encoder;
        this.decoder = decoder;
    }
 
開發者ID:JackWhite20,項目名稱:Cascade,代碼行數:7,代碼來源:CryptoFunction.java

示例5: getDecoder

import io.netty.handler.codec.MessageToMessageDecoder; //導入依賴的package包/類
public MessageToMessageDecoder<ByteBuf> getDecoder() {

        return decoder;
    }
 
開發者ID:JackWhite20,項目名稱:Cascade,代碼行數:5,代碼來源:CryptoFunction.java


注:本文中的io.netty.handler.codec.MessageToMessageDecoder類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。