Package com.sshtools.common.util
Class GeneralUtil
- java.lang.Object
-
- com.sshtools.common.util.GeneralUtil
-
public final class GeneralUtil extends java.lang.ObjectOther 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.StringcolorToString(java.awt.Color color)Return a string representation of a colorstatic java.lang.StringencodeHTML(java.lang.String html)This method will replace '&' with "&", '"' with """, '<' with "<" and '>' with ">".static java.lang.StringnumberToPaddedHexString(int number, int size)Convert a number to a zero padded hex stringstatic java.awt.ColorstringToColor(java.lang.String s)Return aColorobject given a string representation of it
-
-
-
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 aColorobject 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 thansize
-
-