Class GeneralUtil

java.lang.Object
com.sshtools.common.util.GeneralUtil

public final class GeneralUtil extends Object
Other utilities not worth their own class
  • Constructor Details

    • GeneralUtil

      public GeneralUtil()
  • Method Details

    • encodeHTML

      public static String encodeHTML(String html)
      This method will replace '&' with "&", '"' with """, '<' with "<" and '>' with ">".
      Parameters:
      html - html to encode
      Returns:
      encoded html
    • stringToColor

      public static Color stringToColor(String s)
      Return a Color object given a string representation of it
      Parameters:
      color -
      Returns:
      string representation
      Throws:
      IllegalArgumentException - if string in bad format
    • colorToString

      public static String colorToString(Color color)
      Return a string representation of a color
      Parameters:
      color -
      Returns:
      string representation
    • numberToPaddedHexString

      public static String numberToPaddedHexString(int number, int size)
      Convert a number to a zero padded hex string
      Parameters:
      int - number
      Returns:
      zero padded hex string
      Throws:
      IllegalArgumentException - if number takes up more characters than size