Class GeneralUtil


  • public final class GeneralUtil
    extends java.lang.Object
    Other utilities not worth their own class
    • Constructor Summary

      Constructors 
      Constructor Description
      GeneralUtil()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String colorToString​(java.awt.Color color)
      Return a string representation of a color
      static java.lang.String encodeHTML​(java.lang.String html)
      This method will replace '&' with "&", '"' with """, '<' with "<" and '>' with ">".
      static java.lang.String numberToPaddedHexString​(int number, int size)
      Convert a number to a zero padded hex string
      static java.awt.Color stringToColor​(java.lang.String s)
      Return a Color object given a string representation of it
      • Methods inherited from class java.lang.Object

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

      • GeneralUtil

        public GeneralUtil()
    • Method Detail

      • encodeHTML

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

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

        public static java.lang.String colorToString​(java.awt.Color color)
        Return a string representation of a color
        Parameters:
        color -
        Returns:
        string representation
      • numberToPaddedHexString

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