Class LoggerHelper

java.lang.Object
org.mariadb.jdbc.util.log.LoggerHelper

public final class LoggerHelper extends Object
Logger helper to display network exchange
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private static final char[]
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static String
    hex(byte[] header, byte[] bytes, int offset, int dataLength, int trunkLength)
    return a string containing hexa displayable value of arrays
    static String
    hex(byte[] bytes, int offset, int dataLength)
    Write bytes/hexadecimal value of a byte array to a StringBuilder.
    static String
    hex(byte[] bytes, int offset, int dataLength, int trunkLength)
    Transform bytes into readable string format
    private static String
    mediumIntTohexa(int value)
     

    Methods inherited from class java.lang.Object

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

    • hexArray

      private static final char[] hexArray
  • Constructor Details

    • LoggerHelper

      public LoggerHelper()
  • Method Details

    • hex

      public static String hex(byte[] bytes, int offset, int dataLength)
      Write bytes/hexadecimal value of a byte array to a StringBuilder.

      String output example :

      
       +--------------------------------------------------+
       |  0  1  2  3  4  5  6  7   8  9  a  b  c  d  e  f |
       +--------------------------------------------------+------------------+
       | 5F 00 00 00 03 73 65 74  20 61 75 74 6F 63 6F 6D | _....set autocom |
       | 6D 69 74 3D 31 2C 20 73  65 73 73 69 6F 6E 5F 74 | mit=1, session_t |
       | 72 61 63 6B 5F 73 63 68  65 6D 61 3D 31 2C 20 73 | rack_schema=1, s |
       | 71 6C 5F 6D 6F 64 65 20  3D 20 63 6F 6E 63 61 74 | ql_mode = concat |
       | 28 40 40 73 71 6C 5F 6D  6F 64 65 2C 27 2C 53 54 | (@@sql_mode,',ST |
       | 52 49 43 54 5F 54 52 41  4E 53 5F 54 41 42 4C 45 | RICT_TRANS_TABLE |
       | 53 27 29                                         | S')              |
       +--------------------------------------------------+------------------+
       
      Parameters:
      bytes - byte array
      offset - offset
      dataLength - byte length to write
      Returns:
      formated hexa
    • hex

      public static String hex(byte[] bytes, int offset, int dataLength, int trunkLength)
      Transform bytes into readable string format
      Parameters:
      bytes - bytes
      offset - offset
      dataLength - data length
      trunkLength - truncation limit
      Returns:
      readable string format
    • mediumIntTohexa

      private static String mediumIntTohexa(int value)
    • hex

      public static String hex(byte[] header, byte[] bytes, int offset, int dataLength, int trunkLength)
      return a string containing hexa displayable value of arrays
      Parameters:
      header - header array
      bytes - data content
      offset - data offset
      dataLength - data length
      trunkLength - data limit
      Returns:
      displayable value of arrays