public class StringValidateEncodeUtils extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
CHARACTER_ENCODING_UTF_8 |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
containsAmpersandCharacters(String string)
Return true if the given String contains any ampersand ("&")
characters; otherwise return false.
|
static boolean |
containsAngleBracketCharacters(String string)
Return true if the given String contains any less than ("<") or
greater than (">") characters; otherwise return false.
|
static boolean |
containsBackslashCharacters(String string)
Return true if the given String contains any backslash ("\")
characters; otherwise return false.
|
static boolean |
descendOnlyFilePath(String path)
Return true if the given path does not ascend into parent directory.
|
static String |
encodeContentForHtml(String content) |
static String |
encodeLogMessages(String msg) |
static int |
percentHexString2unicodeCodePoint(String percentHexString,
String charsetName)
NOT YET IMPLEMENTED:
Convert a percent hex encoded string (%20) to a unicode code point.
|
static String |
unicodeCodePoint2PercentHexString(int codePoint,
String charsetName)
Return the percentHexOctets string that represents the given Unicode
code point in the given character set or null if the given character
set cannot encode the given code point.
|
static boolean |
validAlphanumericString(String alphNumString)
Return true if the given String is an alphanumeric string.
|
static boolean |
validAlphanumericStringConstrainedSet(String alphNumString,
String[] constrainedSet,
boolean ignoreCase)
Return true if the given String is an alphanumeric string and one of
the valid strings in the constrained set.
|
static boolean |
validBooleanString(String boolString)
Return true if the given String is "true" or "false", ignoring case.
|
static boolean |
validDecimalNumber(String number) |
static boolean |
validFilePath(String path)
Return true if the given String is a valid File path.
|
static boolean |
validIdString(String id)
Return true if the given String is a valid ID string.
|
static boolean |
validPath(String path)
Return true if the given String is a valid path.
|
static boolean |
validPercentHexOctetsString(String percentHexOctetsString)
Check that the given string is a valid percentHexOctets string.
|
static boolean |
validSingleLineString(String singleLineString)
Return true if the given String is a valid single-line String.
|
static boolean |
validUriString(String uri)
Return true if the given String is a valid URI string.
|
public static final String CHARACTER_ENCODING_UTF_8
public static boolean validSingleLineString(String singleLineString)
A string will be considered a valid single-line string if it does not contain any characters from these Unicode general categories:
Or, in other words, allow: Letters, Numbers, Marks, Punctuation, Symbols, and Space separators.
singleLineString - the String to validatepublic static boolean validPath(String path)
A String is considered a valid path if:
path - the String to validatevalidSingleLineString(String)public static boolean validFilePath(String path)
A String is considered a valid File path if:
path - the String to validatevalidPath(String)public static boolean validUriString(String uri)
A String is considered a valid URI path if:
NOTE: Check compliance with URI RFC (RFC 3986) - TODO.
uri - the String to validate.public static boolean validIdString(String id)
A String is considered a valid ID string if:
id - the String to validatevalidSingleLineString(String)public static boolean containsAngleBracketCharacters(String string)
string - the String to check.public static boolean containsAmpersandCharacters(String string)
string - the String to check.public static boolean containsBackslashCharacters(String string)
string - the String to check.public static boolean validDecimalNumber(String number)
public static boolean validBooleanString(String boolString)
boolString - the String to validate.public static boolean validAlphanumericString(String alphNumString)
alphNumString - the String to validate.public static boolean validAlphanumericStringConstrainedSet(String alphNumString, String[] constrainedSet, boolean ignoreCase)
alphNumString - the String to validate.constrainedSet - the set of valid stringsignoreCase - if true ignore the case of the letterspublic static boolean descendOnlyFilePath(String path)
path - the path to checkpublic static int percentHexString2unicodeCodePoint(String percentHexString, String charsetName)
percentHexString - the string to convert to a Unicode code pointcharsetName - the name of the Character set to use in the conversionIllegalArgumentException - if the given percentHex string is not valid or if the requested character set is not supported.public static boolean validPercentHexOctetsString(String percentHexOctetsString)
percentHexOctetsString - the string to check for validitypublic static String unicodeCodePoint2PercentHexString(int codePoint, String charsetName)
codePoint - the given Unicode code pointcharsetName - the name of the character set.IllegalArgumentException - if the code point is not defined or the the character set is not supported.Copyright © 1999-2013 UCAR/Unidata. All Rights Reserved.