public class CHelper
extends java.lang.Object
| Constructor and Description |
|---|
CHelper() |
| Modifier and Type | Method and Description |
|---|---|
static void |
addParameterToPreparedStatement(java.sql.PreparedStatement oStmt,
java.lang.Object fieldValue,
int index,
java.util.Calendar oTimezone,
int maxLength) |
static boolean |
addressLooksValid(java.lang.String sAddress)
Does some basic checks to see if a string looks like a legit email address
|
static char |
decodeEscapedSequenceForHTML(java.lang.String sEscapeSequence)
Decode an HTML escaped sequence to a character.
|
static java.lang.String |
DecodeMimeText(java.lang.String input)
Decodes mime text, eg =?utf-8?B?5a+m6Zqb44SJ6KiI55WrLnppcA==?=
|
static char |
decodeQP(char firstChar,
char secondChar) |
static java.lang.String |
decryptPassword(java.lang.String sInput)
Decrypts the string if it is encrypted, otherwise, just gives it back
|
static java.lang.String |
encryptPassword(java.lang.String sInput)
Encrypts the string if it is decrypted, otherwise, just gives it back
|
static java.lang.String |
getAddress(jakarta.mail.Address address)
Gets the address (not the display name) from an Address object
|
static java.lang.String |
getAddressWithName(jakarta.mail.Address address)
Gets the display name and address from an Address object
|
static int |
getEOLIndex(java.lang.String sInput,
int nIndex)
Used to find the index of the end of the line containing an index.
|
static byte[] |
getFromHex(java.lang.String input) |
static java.lang.String |
getHex(byte[] ba) |
static java.lang.String |
GetPlainMimeType(java.lang.String input)
Turns something like
application/pdf; name="fax-072508-1249.pdf"
into
application/pdf
|
static java.lang.String |
getStackDump(java.lang.Throwable input)
Gets a string containing the stack dump from an exception or error
|
static java.lang.String |
getTokenAtPosition(java.lang.String sInput,
int nIndex)
Gets the word at a location, treating < and > and " and : as whitespace
|
static java.lang.String |
HandleRelativeConfigFileName(java.lang.String sContainingFileName,
java.lang.String sChildFileName)
Returns a filename suitable for use by the operating system given the filename
that refers to the file, and the file that is referred to.
|
static boolean |
IsDigits(java.lang.String input) |
static boolean |
IsHex(java.lang.String input) |
static boolean |
IsUppercaseHex(java.lang.String input) |
static java.lang.String |
NullToEmptyString(java.lang.String input) |
static byte[] |
ReadToEnd(java.io.InputStream is) |
static java.lang.String |
replaceString(java.lang.String sInput,
java.lang.String sSearchFor,
java.lang.String sNewString,
boolean bIgnoreCase)
Replaces all instances of sSearchFor in sInput with sNewString
|
static void |
Sleep(int milliseconds)
Sleeps the specified number of milliseconds without throwing an exception
|
static java.lang.String |
StripCharacters(java.lang.String sInput,
char[] charactersToStrip)
Strips the specified characters from a string
|
static java.lang.String |
StripCharactersEnd(java.lang.String sInput,
char[] charactersToStrip)
Strips the specified characters from the end of a string
|
static java.lang.String |
StripCharactersFront(java.lang.String sInput,
char[] charactersToStrip)
Strips the specified characters from the beginning of a string
|
static java.lang.String |
StripCharactersFrontAndEnd(java.lang.String sInput,
char[] charactersToStrip)
Strips the specified characters from the beginning and end of a string
|
static java.lang.String |
StripWhitespace(java.lang.String sInput)
Strips the whitespace from a string
|
static java.lang.String |
StripWhitespaceForRules(java.lang.String sInput)
Strips the whitespace from a string and some other special characters (eg underscores)
Also converts letters with diacritics to the underlying character
(eg u00EF, LATIN SMALL LETTER I WITH DIAERESIS to i)
|
public static void Sleep(int milliseconds)
milliseconds - The number of milliseconds to sleep.public static java.lang.String replaceString(java.lang.String sInput,
java.lang.String sSearchFor,
java.lang.String sNewString,
boolean bIgnoreCase)
sInput - The original stringsSearchFor - The string to search forsNewString - The string to replace it withbIgnoreCase - True if you want to ignore case when searching for sSearchForpublic static char decodeQP(char firstChar,
char secondChar)
public static char decodeEscapedSequenceForHTML(java.lang.String sEscapeSequence)
throws ResponseMasterDecodingException
sEscapeSequence - The string to decode (e.g. 'lt'). It does not include the
& or the semicolon.ResponseMasterDecodingException - if there is a problempublic static java.lang.String decryptPassword(java.lang.String sInput)
sInput - The input stringpublic static java.lang.String encryptPassword(java.lang.String sInput)
sInput - The plaintext passwordpublic static java.lang.String getTokenAtPosition(java.lang.String sInput,
int nIndex)
sInput - The string to get the token fromnIndex - A position that is in the token or in whitespace before the tokenpublic static int getEOLIndex(java.lang.String sInput,
int nIndex)
sInput - The big stringnIndex - The index of a character in the line that you want the end ofpublic static java.lang.String getStackDump(java.lang.Throwable input)
input - The exception or error to extract the stack dump frompublic static java.lang.String getAddress(jakarta.mail.Address address)
address - The input address objectpublic static java.lang.String getAddressWithName(jakarta.mail.Address address)
address - The input address objectpublic static java.lang.String NullToEmptyString(java.lang.String input)
public static java.lang.String StripWhitespace(java.lang.String sInput)
sInput - The input stringpublic static java.lang.String StripWhitespaceForRules(java.lang.String sInput)
sInput - The input stringpublic static java.lang.String StripCharacters(java.lang.String sInput,
char[] charactersToStrip)
sInput - The string to remove the characters fromcharactersToStrip - The characters to remove.public static java.lang.String StripCharactersFront(java.lang.String sInput,
char[] charactersToStrip)
sInput - The string to remove the characters fromcharactersToStrip - The characters to remove.public static java.lang.String StripCharactersFrontAndEnd(java.lang.String sInput,
char[] charactersToStrip)
sInput - The string to remove the characters fromcharactersToStrip - The characters to remove.public static java.lang.String StripCharactersEnd(java.lang.String sInput,
char[] charactersToStrip)
sInput - The string to remove the characters fromcharactersToStrip - The characters to remove.public static java.lang.String DecodeMimeText(java.lang.String input)
input - The encoded text, eg =?utf-8?B?5a+m6Zqb44SJ6KiI55WrLnppcA==?=public static java.lang.String HandleRelativeConfigFileName(java.lang.String sContainingFileName,
java.lang.String sChildFileName)
sContainingFileName - The full path to the file that contains setting with a potentially relative path.sChildFileName - The potentially relative path to resolve.public static java.lang.String getHex(byte[] ba)
public static byte[] getFromHex(java.lang.String input)
throws ResponseMasterException
ResponseMasterExceptionpublic static byte[] ReadToEnd(java.io.InputStream is)
throws java.io.IOException
java.io.IOExceptionpublic static boolean IsDigits(java.lang.String input)
public static boolean IsHex(java.lang.String input)
public static boolean IsUppercaseHex(java.lang.String input)
public static java.lang.String GetPlainMimeType(java.lang.String input)
input - The mime string to parsepublic static boolean addressLooksValid(java.lang.String sAddress)
sAddress - The string to check.public static void addParameterToPreparedStatement(java.sql.PreparedStatement oStmt,
java.lang.Object fieldValue,
int index,
java.util.Calendar oTimezone,
int maxLength)
throws java.sql.SQLException
java.sql.SQLException