|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.ibm.util.Utility
Field Summary | |
static java.lang.String |
LINE_SEPARATOR
|
Constructor Summary | |
Utility()
|
Method Summary | |
static java.lang.StringBuffer |
appendNumber(java.lang.StringBuffer result,
int n)
Append a number to the given StringBuffer in the radix 10 generating at least one digit. |
static java.lang.StringBuffer |
appendNumber(java.lang.StringBuffer result,
int n,
int radix,
int minDigits)
Append a number to the given StringBuffer in the given radix. |
static boolean |
arrayEquals(double[] source,
java.lang.Object target)
Convenience utility to compare two double[]s Ought to be in System |
static boolean |
arrayEquals(int[] source,
java.lang.Object target)
Convenience utility to compare two int[]s Ought to be in System |
static boolean |
arrayEquals(java.lang.Object[] source,
java.lang.Object target)
Convenience utility to compare two Object[]s. |
static boolean |
arrayEquals(java.lang.Object source,
java.lang.Object target)
Convenience utility to compare two Object[]s Ought to be in System |
static boolean |
arrayRegionMatches(double[] source,
int sourceStart,
double[] target,
int targetStart,
int len)
Convenience utility to compare two arrays of doubles. |
static boolean |
arrayRegionMatches(int[] source,
int sourceStart,
int[] target,
int targetStart,
int len)
Convenience utility to compare two int[]s. |
static boolean |
arrayRegionMatches(java.lang.Object[] source,
int sourceStart,
java.lang.Object[] target,
int targetStart,
int len)
Convenience utility to compare two Object[]s Ought to be in System. |
static java.lang.String |
arrayToRLEString(byte[] a)
Construct a string representing a byte array. |
static java.lang.String |
arrayToRLEString(char[] a)
Construct a string representing a char array. |
static java.lang.String |
arrayToRLEString(int[] a)
Construct a string representing an int array. |
static java.lang.String |
arrayToRLEString(short[] a)
Construct a string representing a short array. |
static java.lang.String |
escape(java.lang.String s)
Convert characters outside the range U+0020 to U+007F to Unicode escapes, and convert backslash to a double backslash. |
static boolean |
escapeUnprintable(java.lang.StringBuffer result,
int c)
Escape unprintable characters using |
static java.lang.String |
formatForSource(java.lang.String s)
Format a String for representation in a source file. |
static java.lang.String |
formatInput(ReplaceableString input,
Transliterator.Position pos)
For debugging purposes; format the given text in the form aaa{bbb|ccc|ddd}eee, where the {} indicate the context start and limit, and the || indicate the start and limit. |
static java.lang.String |
formatInput(Replaceable input,
Transliterator.Position pos)
Convenience method. |
static java.lang.StringBuffer |
formatInput(java.lang.StringBuffer appendTo,
ReplaceableString input,
Transliterator.Position pos)
For debugging purposes; format the given text in the form aaa{bbb|ccc|ddd}eee, where the {} indicate the context start and limit, and the || indicate the start and limit. |
static java.lang.StringBuffer |
formatInput(java.lang.StringBuffer appendTo,
Replaceable input,
Transliterator.Position pos)
Convenience method. |
static void |
getChars(java.lang.StringBuffer src,
int srcBegin,
int srcEnd,
char[] dst,
int dstBegin)
Similar to StringBuffer.getChars, version 1.3. |
static java.lang.String |
hex(char ch)
Convert a char to 4 hex uppercase digits. |
static java.lang.StringBuffer |
hex(char ch,
java.lang.StringBuffer output)
Convert a char to 4 hex uppercase digits. |
static java.lang.String |
hex(int ch,
int width)
Convert a integer to size width (minimum) hex uppercase digits. |
static java.lang.StringBuffer |
hex(int ch,
int width,
java.lang.StringBuffer output)
Convert a integer to size width hex uppercase digits. |
static java.lang.String |
hex(java.lang.String s)
Convert a string to comma-separated groups of 4 hex uppercase digits. |
static java.lang.String |
hex(java.lang.StringBuffer s)
Convert a string to comma-separated groups of 4 hex uppercase digits. |
static java.lang.StringBuffer |
hex(java.lang.String s,
java.lang.StringBuffer result)
Convert a string to comma-separated groups of 4 hex uppercase digits. |
static boolean |
isUnprintable(int c)
Return true if the character is NOT printable ASCII. |
static int |
lookup(java.lang.String source,
java.lang.String[] target)
Look up a given string in a string array. |
static boolean |
objectEquals(java.lang.Object source,
java.lang.Object target)
Convenience utility. |
static int |
parseInteger(java.lang.String rule,
int[] pos,
int limit)
Parse an integer at pos, either of the form \d+ or of the form 0x[0-9A-Fa-f]+ or 0[0-7]+, that is, in standard decimal, hex, or octal format. |
static int |
parsePattern(java.lang.String rule,
int pos,
int limit,
java.lang.String pattern,
int[] parsedInts)
Parse a pattern string starting at offset pos. |
static int |
quotedIndexOf(java.lang.String text,
int start,
int limit,
java.lang.String setOfChars)
Returns the index of the first character in a set, ignoring quoted text. |
static byte[] |
RLEStringToByteArray(java.lang.String s)
Construct an array of bytes from a run-length encoded string. |
static char[] |
RLEStringToCharArray(java.lang.String s)
Construct an array of shorts from a run-length encoded string. |
static int[] |
RLEStringToIntArray(java.lang.String s)
Construct an array of ints from a run-length encoded string. |
static short[] |
RLEStringToShortArray(java.lang.String s)
Construct an array of shorts from a run-length encoded string. |
static int |
skipWhitespace(java.lang.String str,
int pos)
Skip over a sequence of zero or more white space characters at pos. |
static void |
split(java.lang.String s,
char divider,
java.lang.String[] output)
Split a string into pieces based on the given divider character |
static java.lang.StringBuffer |
trim(java.lang.StringBuffer b)
Trim whitespace from ends of a StringBuffer. |
static java.lang.String |
unescape(java.lang.String s)
Convert all escapes in a given string using unescapeAt(). |
static int |
unescapeAt(java.lang.String s,
int[] offset16)
Convert an escape to a 32-bit code point value. |
static java.lang.String |
unescapeLeniently(java.lang.String s)
Convert all escapes in a given string using unescapeAt(). |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static java.lang.String LINE_SEPARATOR
Constructor Detail |
public Utility()
Method Detail |
public static final boolean arrayEquals(java.lang.Object[] source, java.lang.Object target)
public static final boolean arrayEquals(int[] source, java.lang.Object target)
public static final boolean arrayEquals(double[] source, java.lang.Object target)
public static final boolean arrayEquals(java.lang.Object source, java.lang.Object target)
public static final boolean arrayRegionMatches(java.lang.Object[] source, int sourceStart, java.lang.Object[] target, int targetStart, int len)
len
- the length to compare.
The start indices and start+len must be valid.public static final boolean arrayRegionMatches(int[] source, int sourceStart, int[] target, int targetStart, int len)
len
- the length to compare.
The start indices and start+len must be valid.
Ought to be in Systempublic static final boolean arrayRegionMatches(double[] source, int sourceStart, double[] target, int targetStart, int len)
len
- the length to compare.
The start indices and start+len must be valid.
Ought to be in Systempublic static final boolean objectEquals(java.lang.Object source, java.lang.Object target)
public static final java.lang.String arrayToRLEString(int[] a)
public static final java.lang.String arrayToRLEString(short[] a)
public static final java.lang.String arrayToRLEString(char[] a)
public static final java.lang.String arrayToRLEString(byte[] a)
public static final int[] RLEStringToIntArray(java.lang.String s)
public static final short[] RLEStringToShortArray(java.lang.String s)
public static final char[] RLEStringToCharArray(java.lang.String s)
public static final byte[] RLEStringToByteArray(java.lang.String s)
public static final java.lang.String formatForSource(java.lang.String s)
public static final java.lang.String escape(java.lang.String s)
public static int unescapeAt(java.lang.String s, int[] offset16)
offset16
- an array containing offset to the character
after the backslash. Upon return offset16[0] will
be updated to point after the escape sequence.public static java.lang.String unescape(java.lang.String s)
java.lang.IllegalArgumentException
- if an invalid escape is
seen.public static java.lang.String unescapeLeniently(java.lang.String s)
public static java.lang.String hex(char ch)
public static java.lang.String hex(java.lang.String s)
public static java.lang.String hex(java.lang.StringBuffer s)
public static java.lang.StringBuffer hex(char ch, java.lang.StringBuffer output)
public static java.lang.StringBuffer hex(int ch, int width, java.lang.StringBuffer output)
public static java.lang.String hex(int ch, int width)
public static java.lang.StringBuffer hex(java.lang.String s, java.lang.StringBuffer result)
public static void split(java.lang.String s, char divider, java.lang.String[] output)
s
- the string to splitdivider
- the character on which to split. Occurrences of
this character are not included in the outputoutput
- an array to receive the substrings between
instances of divider. It must be large enough on entry to
accomodate all output. Adjacent instances of the divider
character will place empty strings into output. Before
returning, output is padded out with empty strings.public static int lookup(java.lang.String source, java.lang.String[] target)
source
- the string to search fortarget
- the array of zero or more strings in which to
look for sourcepublic static int skipWhitespace(java.lang.String str, int pos)
public static int parsePattern(java.lang.String rule, int pos, int limit, java.lang.String pattern, int[] parsedInts)
pattern
- must only contain lowercase characters, which
will match their uppercase equivalents as well. A space
character matches one or more required spaces. A '~' character
matches zero or more optional spaces. A '#' character matches
an integer and stores it in parsedInts, which the caller must
ensure has enough capacity.parsedInts
- array to receive parsed integers. Caller
must ensure that parsedInts.length is >= the number of '#'
signs in 'pattern'.public static int parseInteger(java.lang.String rule, int[] pos, int limit)
pos
- INPUT-OUTPUT parameter. On input, the first
character to parse. On output, the character after the last
parsed character.public static java.lang.StringBuffer trim(java.lang.StringBuffer b)
public static java.lang.StringBuffer appendNumber(java.lang.StringBuffer result, int n)
public static java.lang.StringBuffer appendNumber(java.lang.StringBuffer result, int n, int radix, int minDigits)
result
- the digits of the number are appended heren
- the number to be converted to digits; may be negative.
If negative, a '-' is prepended to the digits.radix
- a radix from 2 to 36 inclusive.minDigits
- the minimum number of digits, not including
any '-', to produce. Values less than 2 have no effect. One
digit is always emitted regardless of this parameter.public static boolean isUnprintable(int c)
public static boolean escapeUnprintable(java.lang.StringBuffer result, int c)
public static int quotedIndexOf(java.lang.String text, int start, int limit, java.lang.String setOfChars)
setOfChars
.text
- text to be searchedstart
- the beginning index, inclusive; 0 <= start
<= limit
.limit
- the ending index, exclusive; start <= limit
<= text.length()
.setOfChars
- string with one or more distinct characterssetOfChars
found, or -1 if not found.String.indexOf(int)
public static java.lang.String formatInput(ReplaceableString input, Transliterator.Position pos)
public static java.lang.StringBuffer formatInput(java.lang.StringBuffer appendTo, ReplaceableString input, Transliterator.Position pos)
public static java.lang.String formatInput(Replaceable input, Transliterator.Position pos)
public static java.lang.StringBuffer formatInput(java.lang.StringBuffer appendTo, Replaceable input, Transliterator.Position pos)
public static void getChars(java.lang.StringBuffer src, int srcBegin, int srcEnd, char[] dst, int dstBegin)
src
- source string buffersrcBegin
- offset to the start of the src to retrieve fromsrcEnd
- offset to the end of the src to retrieve fromdst
- char array to store the retrieved charsdstBegin
- offset to the start of the destination char array to
store the retrieved chars
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |