Class PipelineUtil


  • public class PipelineUtil
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      PipelineUtil()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.util.List<java.lang.Object> callDecode​(io.netty.handler.codec.ByteToMessageDecoder decoder, io.netty.channel.ChannelHandlerContext ctx, java.lang.Object input)
      Call the decode method on a netty ByteToMessageDecoder
      static java.util.List<java.lang.Object> callDecode​(io.netty.handler.codec.MessageToMessageDecoder decoder, io.netty.channel.ChannelHandlerContext ctx, java.lang.Object msg)  
      static void callEncode​(io.netty.handler.codec.MessageToByteEncoder encoder, io.netty.channel.ChannelHandlerContext ctx, java.lang.Object msg, io.netty.buffer.ByteBuf output)
      Call the encode method on a netty MessageToByteEncoder
      static boolean containsCause​(java.lang.Throwable t, java.lang.Class<?> c)
      Check if a stack trace contains a certain exception
      static io.netty.channel.ChannelHandlerContext getContextBefore​(java.lang.String name, io.netty.channel.ChannelPipeline pipeline)
      Get the context for a the channel handler before a certain name.
      static io.netty.channel.ChannelHandlerContext getPreviousContext​(java.lang.String name, io.netty.channel.ChannelPipeline pipeline)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PipelineUtil

        public PipelineUtil()
    • Method Detail

      • callDecode

        public static java.util.List<java.lang.Object> callDecode​(io.netty.handler.codec.ByteToMessageDecoder decoder,
                                                                  io.netty.channel.ChannelHandlerContext ctx,
                                                                  java.lang.Object input)
                                                           throws java.lang.reflect.InvocationTargetException
        Call the decode method on a netty ByteToMessageDecoder
        Parameters:
        decoder - The decoder
        ctx - The current context
        input - The packet to decode
        Returns:
        A list of the decoders output
        Throws:
        java.lang.reflect.InvocationTargetException - If an exception happens while executing
      • callEncode

        public static void callEncode​(io.netty.handler.codec.MessageToByteEncoder encoder,
                                      io.netty.channel.ChannelHandlerContext ctx,
                                      java.lang.Object msg,
                                      io.netty.buffer.ByteBuf output)
                               throws java.lang.reflect.InvocationTargetException
        Call the encode method on a netty MessageToByteEncoder
        Parameters:
        encoder - The encoder
        ctx - The current context
        msg - The packet to encode
        output - The bytebuf to write the output to
        Throws:
        java.lang.reflect.InvocationTargetException - If an exception happens while executing
      • callDecode

        public static java.util.List<java.lang.Object> callDecode​(io.netty.handler.codec.MessageToMessageDecoder decoder,
                                                                  io.netty.channel.ChannelHandlerContext ctx,
                                                                  java.lang.Object msg)
                                                           throws java.lang.reflect.InvocationTargetException
        Throws:
        java.lang.reflect.InvocationTargetException
      • containsCause

        public static boolean containsCause​(java.lang.Throwable t,
                                            java.lang.Class<?> c)
        Check if a stack trace contains a certain exception
        Parameters:
        t - The throwable
        c - The exception to look for
        Returns:
        True if the stack trace contained it as its cause or if t is an instance of c.
      • getContextBefore

        public static io.netty.channel.ChannelHandlerContext getContextBefore​(java.lang.String name,
                                                                              io.netty.channel.ChannelPipeline pipeline)
        Get the context for a the channel handler before a certain name.
        Parameters:
        name - The name of the channel handler
        pipeline - The pipeline to target
        Returns:
        The ChannelHandler before the one requested.
      • getPreviousContext

        public static io.netty.channel.ChannelHandlerContext getPreviousContext​(java.lang.String name,
                                                                                io.netty.channel.ChannelPipeline pipeline)