Package com.gentlyweb.utils
Class GeneralUtils
- java.lang.Object
-
- com.gentlyweb.utils.GeneralUtils
-
public class GeneralUtils extends Object
A Class to hold some general purpose Utilities that don't have a home anywhere else (at the moment).
You should NOT rely on these methods staying in this class.
All methods in this class are static.
-
-
Field Summary
Fields Modifier and Type Field Description static String
GENTLYWEB_EMAIL
-
Constructor Summary
Constructors Constructor Description GeneralUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
getExceptionTraceAsString(Exception e)
Get an exception (and if it's an instance ofChainException
) the chain of exceptions (if present) as a String.static void
getMethods(Class c, String name, int mods, List ms)
static void
validateIPv4Address(String ipaddress)
Validate an IPv4 address (string) passed in, it must conform to the following rules: Must have 4 parts. Parts must be separated by . The first octet must be in the range 0-223. The second and third octets must be in the range 0-255 4th octet can be either a number in the range 1-254 (0 is the name of the network, 255 is the broadcast address). All parts must be numbers...
-
-
-
Field Detail
-
GENTLYWEB_EMAIL
public static String GENTLYWEB_EMAIL
-
-
Method Detail
-
getExceptionTraceAsString
public static String getExceptionTraceAsString(Exception e) throws IOException
Get an exception (and if it's an instance ofChainException
) the chain of exceptions (if present) as a String.- Parameters:
e
- The exception- Returns:
- A String of the exception chain.
- Throws:
IOException
- Should never happen since we are using a StringWriter.
-
validateIPv4Address
public static void validateIPv4Address(String ipaddress) throws Exception
Validate an IPv4 address (string) passed in, it must conform to the following rules:- Must have 4 parts.
- Parts must be separated by .
- The first octet must be in the range 0-223.
- The second and third octets must be in the range 0-255
- 4th octet can be either a number in the range 1-254 (0 is the name of the network, 255 is the broadcast address).
- All parts must be numbers...
- Parameters:
ipaddress
- The ip address to validate.- Throws:
Exception
- If one of the rules is broken.
-
-