Class Util


  • public class Util
    extends java.lang.Object
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.util.concurrent.CompletableFuture<java.lang.Void> COMPLETED_VOID_FUTURE  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean compareIgnoreCase​(byte b1, byte b2)  
      static java.util.concurrent.ThreadFactory daemonThreadFactory​(java.lang.String prefix)  
      static Benchmark deserialize​(byte[] bytes)  
      static java.lang.String explainCauses​(java.lang.Throwable e)  
      static boolean hasPrefix​(io.netty.buffer.ByteBuf data, int offset, int length, byte[] prefix)  
      static void intAsText2byteBuf​(int value, io.netty.buffer.ByteBuf buf)  
      static boolean isAscii​(io.netty.buffer.ByteBuf cs, int offset, int len)  
      static boolean isLatin​(java.lang.CharSequence cs)  
      static boolean isParamConvertible​(java.lang.Class<?> type)  
      static long parseLong​(io.netty.buffer.ByteBuf data, int offset, int length)  
      static long parseLong​(java.lang.CharSequence string)  
      static long parseLong​(java.lang.CharSequence string, int begin, int end)  
      static long parseLong​(java.lang.CharSequence string, int begin, int end, long defaultValue)  
      static long parseToMillis​(java.lang.String time)  
      static long parseToNanos​(java.lang.String time)  
      static int pow​(int base, int exp)  
      static java.lang.String prettyPrintData​(double value)  
      static java.lang.String prettyPrintNanos​(long timeNanos)  
      static java.lang.String prettyPrintNanos​(long timeNanos, java.lang.String width, boolean spaceBeforeUnit)
      Pretty prints time
      static java.lang.String prettyPrintNanosFixed​(long timeNanos)
      Pretty prints timeNanos in 9 spaces
      static java.lang.String prettyPrintObject​(java.lang.Object value)  
      static boolean regionMatches​(java.lang.CharSequence a, int aoffset, java.lang.CharSequence b, int boffset, int length)  
      static boolean regionMatchesIgnoreCase​(java.lang.CharSequence a, int aoffset, java.lang.CharSequence b, int boffset, int length)  
      static byte[] serialize​(Benchmark benchmark)  
      static boolean startsWith​(java.lang.CharSequence sequence, int offset, java.lang.CharSequence prefix)  
      static io.netty.buffer.ByteBuf string2byteBuf​(java.lang.CharSequence str, io.netty.buffer.ByteBuf buffer)  
      static io.netty.util.AsciiString toAsciiString​(io.netty.buffer.ByteBuf buf, int offset, int length)  
      static byte[] toByteArray​(java.io.InputStream stream)  
      static byte toLowerCase​(byte b)  
      static java.lang.String toString​(io.netty.buffer.ByteBuf buf, int offset, int length)  
      static java.lang.String toString​(java.io.InputStream stream)  
      static byte toUpperCase​(byte b)  
      static void urlEncode​(java.lang.String string, io.netty.buffer.ByteBuf buf)  
      • Methods inherited from class java.lang.Object

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

      • COMPLETED_VOID_FUTURE

        public static final java.util.concurrent.CompletableFuture<java.lang.Void> COMPLETED_VOID_FUTURE
    • Method Detail

      • compareIgnoreCase

        public static boolean compareIgnoreCase​(byte b1,
                                                byte b2)
      • toLowerCase

        public static byte toLowerCase​(byte b)
      • toUpperCase

        public static byte toUpperCase​(byte b)
      • prettyPrintNanosFixed

        public static java.lang.String prettyPrintNanosFixed​(long timeNanos)
        Pretty prints timeNanos in 9 spaces
        Parameters:
        timeNanos - Time in nanoseconds.
        Returns:
        Formatted string.
      • prettyPrintNanos

        public static java.lang.String prettyPrintNanos​(long timeNanos,
                                                        java.lang.String width,
                                                        boolean spaceBeforeUnit)
        Pretty prints time
        Parameters:
        timeNanos - Time in nanoseconds.
        width - Number of characters in the number, as string
        spaceBeforeUnit - Separate number and unit with a space.
        Returns:
        Formatted string.
      • prettyPrintNanos

        public static java.lang.String prettyPrintNanos​(long timeNanos)
      • toString

        public static java.lang.String toString​(io.netty.buffer.ByteBuf buf,
                                                int offset,
                                                int length)
      • isLatin

        public static boolean isLatin​(java.lang.CharSequence cs)
      • isAscii

        public static boolean isAscii​(io.netty.buffer.ByteBuf cs,
                                      int offset,
                                      int len)
      • toAsciiString

        public static io.netty.util.AsciiString toAsciiString​(io.netty.buffer.ByteBuf buf,
                                                              int offset,
                                                              int length)
      • string2byteBuf

        public static io.netty.buffer.ByteBuf string2byteBuf​(java.lang.CharSequence str,
                                                             io.netty.buffer.ByteBuf buffer)
      • explainCauses

        public static java.lang.String explainCauses​(java.lang.Throwable e)
      • regionMatchesIgnoreCase

        public static boolean regionMatchesIgnoreCase​(java.lang.CharSequence a,
                                                      int aoffset,
                                                      java.lang.CharSequence b,
                                                      int boffset,
                                                      int length)
      • regionMatches

        public static boolean regionMatches​(java.lang.CharSequence a,
                                            int aoffset,
                                            java.lang.CharSequence b,
                                            int boffset,
                                            int length)
      • startsWith

        public static boolean startsWith​(java.lang.CharSequence sequence,
                                         int offset,
                                         java.lang.CharSequence prefix)
      • pow

        public static int pow​(int base,
                              int exp)
      • parseLong

        public static long parseLong​(io.netty.buffer.ByteBuf data,
                                     int offset,
                                     int length)
      • isParamConvertible

        public static boolean isParamConvertible​(java.lang.Class<?> type)
      • prettyPrintObject

        public static java.lang.String prettyPrintObject​(java.lang.Object value)
      • hasPrefix

        public static boolean hasPrefix​(io.netty.buffer.ByteBuf data,
                                        int offset,
                                        int length,
                                        byte[] prefix)
      • serialize

        public static byte[] serialize​(Benchmark benchmark)
                                throws java.io.IOException
        Throws:
        java.io.IOException
      • deserialize

        public static Benchmark deserialize​(byte[] bytes)
                                     throws java.io.IOException,
                                            java.lang.ClassNotFoundException
        Throws:
        java.io.IOException
        java.lang.ClassNotFoundException
      • toByteArray

        public static byte[] toByteArray​(java.io.InputStream stream)
                                  throws java.io.IOException
        Throws:
        java.io.IOException
      • toString

        public static java.lang.String toString​(java.io.InputStream stream)
                                         throws java.io.IOException
        Throws:
        java.io.IOException
      • parseLong

        public static long parseLong​(java.lang.CharSequence string)
      • parseLong

        public static long parseLong​(java.lang.CharSequence string,
                                     int begin,
                                     int end)
      • parseLong

        public static long parseLong​(java.lang.CharSequence string,
                                     int begin,
                                     int end,
                                     long defaultValue)
      • parseToNanos

        public static long parseToNanos​(java.lang.String time)
      • parseToMillis

        public static long parseToMillis​(java.lang.String time)
      • daemonThreadFactory

        public static java.util.concurrent.ThreadFactory daemonThreadFactory​(java.lang.String prefix)
      • urlEncode

        public static void urlEncode​(java.lang.String string,
                                     io.netty.buffer.ByteBuf buf)
      • prettyPrintData

        public static java.lang.String prettyPrintData​(double value)
      • intAsText2byteBuf

        public static void intAsText2byteBuf​(int value,
                                             io.netty.buffer.ByteBuf buf)