| java.lang.Object sun.text.Utility
Utility | final public class Utility (Code) | | |
Field Summary | |
final static char | ESCAPE The ESCAPE character is used during run-length encoding. | final static byte | ESCAPE_BYTE The ESCAPE_BYTE character is used during run-length encoding. | final static char[] | HEX_DIGIT |
Method Summary | |
final public static byte[] | RLEStringToByteArray(String s) Construct an array of bytes from a run-length encoded string. | final public static char[] | RLEStringToCharArray(String s) Construct an array of shorts from a run-length encoded string. | final public static int[] | RLEStringToIntArray(String s) Construct an array of ints from a run-length encoded string. | final public static short[] | RLEStringToShortArray(String s) Construct an array of shorts from a run-length encoded string. | final public static boolean | arrayEquals(Object[] source, Object target) Convenience utility to compare two Object[]s. | final public static boolean | arrayEquals(int[] source, Object target) | final public static boolean | arrayEquals(double[] source, Object target) | final public static boolean | arrayEquals(Object source, Object target) | final public static boolean | arrayRegionMatches(Object[] source, int sourceStart, Object[] target, int targetStart, int len) Convenience utility to compare two Object[]s
Ought to be in System. | final public static boolean | arrayRegionMatches(int[] source, int sourceStart, int[] target, int targetStart, int len) Convenience utility to compare two int[]s. | final public static boolean | arrayRegionMatches(double[] source, int sourceStart, double[] target, int targetStart, int len) Convenience utility to compare two arrays of doubles. | final public static String | arrayToRLEString(short[] a) Construct a string representing a short array. | final public static String | arrayToRLEString(byte[] a) Construct a string representing a byte array. | final public static String | arrayToRLEString(char[] a) Construct a string representing a char array. | final public static String | arrayToRLEString(int[] a) Construct a string representing an int array. | final public static String | formatForSource(String s) Format a String for representation in a source file. | final static int | getInt(String s, int i) | final public static String | hex(char ch) | final public static StringBuffer | hex(String src, StringBuffer buff) | final public static String | hex(String str) | final public static String | hex(StringBuffer buff) | final public static StringBuffer | hex(char ch, StringBuffer buff) | final public static boolean | objectEquals(Object source, Object target) Convenience utility. |
ESCAPE | final static char ESCAPE(Code) | | The ESCAPE character is used during run-length encoding. It signals
a run of identical chars.
|
ESCAPE_BYTE | final static byte ESCAPE_BYTE(Code) | | The ESCAPE_BYTE character is used during run-length encoding. It signals
a run of identical bytes.
|
HEX_DIGIT | final static char[] HEX_DIGIT(Code) | | |
RLEStringToByteArray | final public static byte[] RLEStringToByteArray(String s)(Code) | | Construct an array of bytes from a run-length encoded string.
|
RLEStringToCharArray | final public static char[] RLEStringToCharArray(String s)(Code) | | Construct an array of shorts from a run-length encoded string.
|
RLEStringToIntArray | final public static int[] RLEStringToIntArray(String s)(Code) | | Construct an array of ints from a run-length encoded string.
|
RLEStringToShortArray | final public static short[] RLEStringToShortArray(String s)(Code) | | Construct an array of shorts from a run-length encoded string.
|
arrayEquals | final public static boolean arrayEquals(Object[] source, Object target)(Code) | | Convenience utility to compare two Object[]s.
Ought to be in System
|
arrayEquals | final public static boolean arrayEquals(int[] source, Object target)(Code) | | Convenience utility to compare two int[]s
Ought to be in System
|
arrayEquals | final public static boolean arrayEquals(double[] source, Object target)(Code) | | Convenience utility to compare two double[]s
Ought to be in System
|
arrayEquals | final public static boolean arrayEquals(Object source, Object target)(Code) | | Convenience utility to compare two Object[]s
Ought to be in System
|
arrayRegionMatches | final public static boolean arrayRegionMatches(Object[] source, int sourceStart, Object[] target, int targetStart, int len)(Code) | | Convenience utility to compare two Object[]s
Ought to be in System.
Parameters: len - the length to compare.The start indices and start+len must be valid. |
arrayRegionMatches | final public static boolean arrayRegionMatches(int[] source, int sourceStart, int[] target, int targetStart, int len)(Code) | | Convenience utility to compare two int[]s.
Parameters: len - the length to compare.The start indices and start+len must be valid.Ought to be in System |
arrayRegionMatches | final public static boolean arrayRegionMatches(double[] source, int sourceStart, double[] target, int targetStart, int len)(Code) | | Convenience utility to compare two arrays of doubles.
Parameters: len - the length to compare.The start indices and start+len must be valid.Ought to be in System |
arrayToRLEString | final public static String arrayToRLEString(short[] a)(Code) | | Construct a string representing a short array. Use run-length encoding.
A character represents itself, unless it is the ESCAPE character. Then
the following notations are possible:
ESCAPE ESCAPE ESCAPE literal
ESCAPE n c n instances of character c
Since an encoded run occupies 3 characters, we only encode runs of 4 or
more characters. Thus we have n > 0 and n != ESCAPE and n <= 0xFFFF.
If we encounter a run where n == ESCAPE, we represent this as:
c ESCAPE n-1 c
The ESCAPE value is chosen so as not to collide with commonly
seen values.
|
arrayToRLEString | final public static String arrayToRLEString(byte[] a)(Code) | | Construct a string representing a byte array. Use run-length encoding.
Two bytes are packed into a single char, with a single extra zero byte at
the end if needed. A byte represents itself, unless it is the
ESCAPE_BYTE. Then the following notations are possible:
ESCAPE_BYTE ESCAPE_BYTE ESCAPE_BYTE literal
ESCAPE_BYTE n b n instances of byte b
Since an encoded run occupies 3 bytes, we only encode runs of 4 or
more bytes. Thus we have n > 0 and n != ESCAPE_BYTE and n <= 0xFF.
If we encounter a run where n == ESCAPE_BYTE, we represent this as:
b ESCAPE_BYTE n-1 b
The ESCAPE_BYTE value is chosen so as not to collide with commonly
seen values.
|
arrayToRLEString | final public static String arrayToRLEString(char[] a)(Code) | | Construct a string representing a char array. Use run-length encoding.
A character represents itself, unless it is the ESCAPE character. Then
the following notations are possible:
ESCAPE ESCAPE ESCAPE literal
ESCAPE n c n instances of character c
Since an encoded run occupies 3 characters, we only encode runs of 4 or
more characters. Thus we have n > 0 and n != ESCAPE and n <= 0xFFFF.
If we encounter a run where n == ESCAPE, we represent this as:
c ESCAPE n-1 c
The ESCAPE value is chosen so as not to collide with commonly
seen values.
|
arrayToRLEString | final public static String arrayToRLEString(int[] a)(Code) | | Construct a string representing an int array. Use run-length encoding.
A character represents itself, unless it is the ESCAPE character. Then
the following notations are possible:
ESCAPE ESCAPE ESCAPE literal
ESCAPE n c n instances of character c
Since an encoded run occupies 3 characters, we only encode runs of 4 or
more characters. Thus we have n > 0 and n != ESCAPE and n <= 0xFFFF.
If we encounter a run where n == ESCAPE, we represent this as:
c ESCAPE n-1 c
The ESCAPE value is chosen so as not to collide with commonly
seen values.
|
formatForSource | final public static String formatForSource(String s)(Code) | | Format a String for representation in a source file. This includes
breaking it into lines escaping characters using octal notation
when necessary (control characters and double quotes).
|
objectEquals | final public static boolean objectEquals(Object source, Object target)(Code) | | Convenience utility. Does null checks on objects, then calls equals.
|
|
|