Java Doc for Utility.java in  » Internationalization-Localization » icu4j » com » ibm » icu » impl » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Internationalization Localization » icu4j » com.ibm.icu.impl 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.ibm.icu.impl.Utility

Utility
final public class Utility (Code)


Field Summary
final static  charDIGITS
    
final static  byteESCAPE_BYTE
     The ESCAPE_BYTE character is used during run-length encoding.
final static  char[]HEX_DIGIT
    
public static  StringLINE_SEPARATOR
    


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.
public static  StringBufferappendNumber(StringBuffer result, int n)
     Append a number to the given StringBuffer in the radix 10 generating at least one digit.
public static  StringBufferappendNumber(StringBuffer result, int n, int radix, int minDigits)
     Append a number to the given StringBuffer in the given radix. Standard digits '0'-'9' are used and letters 'A'-'Z' for radices 11 through 36.
Parameters:
  result - the digits of the number are appended here
Parameters:
  n - the number to be converted to digits; may be negative.If negative, a '-' is prepended to the digits.
Parameters:
  radix - a radix from 2 to 36 inclusive.
Parameters:
  minDigits - the minimum number of digits, not includingany '-', to produce.
public static  voidappendToRule(StringBuffer rule, int c, boolean isLiteral, boolean escapeUnprintable, StringBuffer quoteBuf)
     Append a character to a rule that is being built up.
public static  voidappendToRule(StringBuffer rule, String text, boolean isLiteral, boolean escapeUnprintable, StringBuffer quoteBuf)
     Append the given string to the rule.
public static  voidappendToRule(StringBuffer rule, UnicodeMatcher matcher, boolean escapeUnprintable, StringBuffer quoteBuf)
     Given a matcher reference, which may be null, append its pattern as a literal to the given rule.
final public static  booleanarrayEquals(Object[] source, Object target)
     Convenience utility to compare two Object[]s.
final public static  booleanarrayEquals(int[] source, Object target)
    
final public static  booleanarrayEquals(double[] source, Object target)
    
final public static  booleanarrayEquals(byte[] source, Object target)
    
final public static  booleanarrayEquals(Object source, Object target)
    
final public static  booleanarrayRegionMatches(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  booleanarrayRegionMatches(char[] source, int sourceStart, char[] target, int targetStart, int len)
     Convenience utility to compare two Object[]s Ought to be in System.
final public static  booleanarrayRegionMatches(int[] source, int sourceStart, int[] target, int targetStart, int len)
     Convenience utility to compare two int[]s.
final public static  booleanarrayRegionMatches(double[] source, int sourceStart, double[] target, int targetStart, int len)
     Convenience utility to compare two arrays of doubles.
final public static  booleanarrayRegionMatches(byte[] source, int sourceStart, byte[] target, int targetStart, int len)
    
final public static  StringarrayToRLEString(int[] a)
     Construct a string representing an int array.
final public static  StringarrayToRLEString(short[] a)
     Construct a string representing a short array.
final public static  StringarrayToRLEString(char[] a)
     Construct a string representing a char array.
final public static  StringarrayToRLEString(byte[] a)
     Construct a string representing a byte array.
final public static  intcompareUnsigned(int source, int target)
    
public static  StringdeleteRuleWhiteSpace(String str)
     Remove all rule white space from a string.
final public static  Stringescape(String s)
     Convert characters outside the range U+0020 to U+007F to Unicode escapes, and convert backslash to a double backslash.
public static  booleanescapeUnprintable(StringBuffer result, int c)
     Escape unprintable characters using uxxxx notation for U+0000 to U+FFFF and Uxxxxxxxx for U+10000 and above.
final public static  Stringformat1ForSource(String s)
     Format a String for representation in a source file.
final public static  StringformatForSource(String s)
     Format a String for representation in a source file.
public static  voidgetChars(StringBuffer src, int srcBegin, int srcEnd, char dst, int dstBegin)
     Similar to StringBuffer.getChars, version 1.3.
final static  intgetInt(String s, int i)
    
public static  Stringhex(char ch)
     Convert a char to 4 hex uppercase digits.
public static  Stringhex(String s)
     Convert a string to comma-separated groups of 4 hex uppercase digits.
public static  Stringhex(StringBuffer s)
     Convert a string to comma-separated groups of 4 hex uppercase digits.
public static  StringBufferhex(char ch, StringBuffer output)
     Convert a char to 4 hex uppercase digits.
public static  StringBufferhex(int ch, int width, StringBuffer output)
     Convert a integer to size width hex uppercase digits.
public static  Stringhex(int ch, int width)
     Convert a integer to size width (minimum) hex uppercase digits. E.g., hex('a', 4, str) => "0041".
public static  Stringhex(long i, int places)
    
public static  Stringhex(long ch)
    
public static  StringBufferhex(String s, StringBuffer result)
     Convert a string to comma-separated groups of 4 hex uppercase digits.
final public static  bytehighBit(int n)
     Find the highest bit in a positive integer.
public static  intindexOf(StringBuffer buf, String s)
    
public static  intindexOf(StringBuffer buf, String s, int i)
    
public static  booleanisUnprintable(int c)
     Return true if the character is NOT printable ASCII.
public static  intlastIndexOf(StringBuffer buf, String s)
    
public static  intlastIndexOf(StringBuffer buf, String s, int i)
    
public static  intlookup(String source, String[] target)
     Look up a given string in a string array.
final public static  booleanobjectEquals(Object source, Object target)
     Convenience utility.
public static  booleanparseChar(String id, int[] pos, char ch)
     Parse a single non-whitespace character 'ch', optionally preceded by whitespace.
Parameters:
  id - the string to be parsed
Parameters:
  pos - INPUT-OUTPUT parameter.
public static  intparseInteger(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.
Parameters:
  pos - INPUT-OUTPUT parameter.
public static  intparseNumber(String text, int[] pos, int radix)
     Parse an unsigned 31-bit integer at the given offset.
public static  intparsePattern(String rule, int pos, int limit, String pattern, int[] parsedInts)
     Parse a pattern string starting at offset pos.
public static  intparsePattern(String pat, Replaceable text, int index, int limit)
     Parse a pattern string within the given Replaceable and a parsing pattern.
public static  StringparseUnicodeIdentifier(String str, int[] pos)
     Parse a Unicode identifier from the given string at the given position.
public static  intquotedIndexOf(String text, int start, int limit, String setOfChars)
     Returns the index of the first character in a set, ignoring quoted text. For example, in the string "abc'hide'h", the 'h' in "hide" will not be found by a search for "h".
public static  Stringrepeat(String s, int count)
    
public static  StringreplaceAll(String src, String target, String replacement)
    
public static  intskipWhitespace(String str, int pos)
     Skip over a sequence of zero or more white space characters at pos.
public static  voidskipWhitespace(String str, int[] pos)
     Skip over a sequence of zero or more white space characters at pos[0], advancing it.
public static  voidsplit(String s, char divider, String[] output)
     Split a string into pieces based on the given divider character
Parameters:
  s - the string to split
Parameters:
  divider - the character on which to split.
public static  String[]split(String s, char divider)
     Split a string into pieces based on the given divider character
Parameters:
  s - the string to split
Parameters:
  divider - the character on which to split.
public static  StringBuffertrim(StringBuffer b)
     Trim whitespace from ends of a StringBuffer.
public static  Stringunescape(String s)
     Convert all escapes in a given string using unescapeAt().
public static  intunescapeAt(String s, int[] offset16)
     Convert an escape to a 32-bit code point value.
public static  StringunescapeLeniently(String s)
     Convert all escapes in a given string using unescapeAt().
public static  StringvalueOf(int[] source)
     Utility method to take a int[] containing codepoints and return a string representation with code units.

Field Detail
DIGITS
final static char DIGITS(Code)



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)



LINE_SEPARATOR
public static String LINE_SEPARATOR(Code)





Method Detail
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.



appendNumber
public static StringBuffer appendNumber(StringBuffer result, int n)(Code)
Append a number to the given StringBuffer in the radix 10 generating at least one digit.



appendNumber
public static StringBuffer appendNumber(StringBuffer result, int n, int radix, int minDigits) throws IllegalArgumentException(Code)
Append a number to the given StringBuffer in the given radix. Standard digits '0'-'9' are used and letters 'A'-'Z' for radices 11 through 36.
Parameters:
  result - the digits of the number are appended here
Parameters:
  n - the number to be converted to digits; may be negative.If negative, a '-' is prepended to the digits.
Parameters:
  radix - a radix from 2 to 36 inclusive.
Parameters:
  minDigits - the minimum number of digits, not includingany '-', to produce. Values less than 2 have no effect. Onedigit is always emitted regardless of this parameter. a reference to result



appendToRule
public static void appendToRule(StringBuffer rule, int c, boolean isLiteral, boolean escapeUnprintable, StringBuffer quoteBuf)(Code)
Append a character to a rule that is being built up. To flush the quoteBuf to rule, make one final call with isLiteral == true. If there is no final character, pass in (int)-1 as c.
Parameters:
  rule - the string to append the character to
Parameters:
  c - the character to append, or (int)-1 if none.
Parameters:
  isLiteral - if true, then the given character should not bequoted or escaped. Usually this means it is a syntactic elementsuch as > or $
Parameters:
  escapeUnprintable - if true, then unprintable charactersshould be escaped using escapeUnprintable(). These escapes willappear outside of quotes.
Parameters:
  quoteBuf - a buffer which is used to build up quotedsubstrings. The caller should initially supply an empty buffer,and thereafter should not modify the buffer. The buffer should becleared out by, at the end, calling this method with a literalcharacter (which may be -1).



appendToRule
public static void appendToRule(StringBuffer rule, String text, boolean isLiteral, boolean escapeUnprintable, StringBuffer quoteBuf)(Code)
Append the given string to the rule. Calls the single-character version of appendToRule for each character.



appendToRule
public static void appendToRule(StringBuffer rule, UnicodeMatcher matcher, boolean escapeUnprintable, StringBuffer quoteBuf)(Code)
Given a matcher reference, which may be null, append its pattern as a literal to the given rule.



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(byte[] source, Object target)(Code)



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(char[] source, int sourceStart, char[] 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



arrayRegionMatches
final public static boolean arrayRegionMatches(byte[] source, int sourceStart, byte[] target, int targetStart, int len)(Code)



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.



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(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(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.



compareUnsigned
final public static int compareUnsigned(int source, int target)(Code)
Compares 2 unsigned integers
Parameters:
  source - 32 bit unsigned integer
Parameters:
  target - 32 bit unsigned integer 0 if equals, 1 if source is greater than target and -1otherwise



deleteRuleWhiteSpace
public static String deleteRuleWhiteSpace(String str)(Code)
Remove all rule white space from a string.



escape
final public static String escape(String s)(Code)
Convert characters outside the range U+0020 to U+007F to Unicode escapes, and convert backslash to a double backslash.



escapeUnprintable
public static boolean escapeUnprintable(StringBuffer result, int c)(Code)
Escape unprintable characters using uxxxx notation for U+0000 to U+FFFF and Uxxxxxxxx for U+10000 and above. If the character is printable ASCII, then do nothing and return FALSE. Otherwise, append the escaped notation and return TRUE.



format1ForSource
final public static String format1ForSource(String s)(Code)
Format a String for representation in a source file. Like formatForSource but does not do line breaking.



formatForSource
final public static String formatForSource(String s)(Code)
Format a String for representation in a source file. This includes breaking it into lines and escaping characters using octal notation when necessary (control characters and double quotes).



getChars
public static void getChars(StringBuffer src, int srcBegin, int srcEnd, char dst, int dstBegin)(Code)
Similar to StringBuffer.getChars, version 1.3. Since JDK 1.2 implements StringBuffer.getChars differently, this method is here to provide consistent results. To be removed after JDK 1.2 ceased to be the reference platform.
Parameters:
  src - source string buffer
Parameters:
  srcBegin - offset to the start of the src to retrieve from
Parameters:
  srcEnd - offset to the end of the src to retrieve from
Parameters:
  dst - char array to store the retrieved chars
Parameters:
  dstBegin - offset to the start of the destination char array tostore the retrieved chars



getInt
final static int getInt(String s, int i)(Code)



hex
public static String hex(char ch)(Code)
Convert a char to 4 hex uppercase digits. E.g., hex('a') => "0041".



hex
public static String hex(String s)(Code)
Convert a string to comma-separated groups of 4 hex uppercase digits. E.g., hex('ab') => "0041,0042".



hex
public static String hex(StringBuffer s)(Code)
Convert a string to comma-separated groups of 4 hex uppercase digits. E.g., hex('ab') => "0041,0042".



hex
public static StringBuffer hex(char ch, StringBuffer output)(Code)
Convert a char to 4 hex uppercase digits. E.g., hex('a') => "0041". Append the output to the given StringBuffer.



hex
public static StringBuffer hex(int ch, int width, StringBuffer output)(Code)
Convert a integer to size width hex uppercase digits. E.g., hex('a', 4, str) => "0041". Append the output to the given StringBuffer. If width is too small to fit, nothing will be appended to output.



hex
public static String hex(int ch, int width)(Code)
Convert a integer to size width (minimum) hex uppercase digits. E.g., hex('a', 4, str) => "0041". If the integer requires more than width digits, more will be used.



hex
public static String hex(long i, int places)(Code)
Supplies a zero-padded hex representation of an integer (without 0x)



hex
public static String hex(long ch)(Code)



hex
public static StringBuffer hex(String s, StringBuffer result)(Code)
Convert a string to comma-separated groups of 4 hex uppercase digits. E.g., hex('ab') => "0041,0042". Append the output to the given StringBuffer.



highBit
final public static byte highBit(int n)(Code)
Find the highest bit in a positive integer. This is done by doing a binary search through the bits.
Parameters:
  n - is the integer the bit number of the highest bit, with 0 beingthe low order bit, or -1 if n is not positive



indexOf
public static int indexOf(StringBuffer buf, String s)(Code)



indexOf
public static int indexOf(StringBuffer buf, String s, int i)(Code)



isUnprintable
public static boolean isUnprintable(int c)(Code)
Return true if the character is NOT printable ASCII. The tab, newline and linefeed characters are considered unprintable.



lastIndexOf
public static int lastIndexOf(StringBuffer buf, String s)(Code)



lastIndexOf
public static int lastIndexOf(StringBuffer buf, String s, int i)(Code)



lookup
public static int lookup(String source, String[] target)(Code)
Look up a given string in a string array. Returns the index at which the first occurrence of the string was found in the array, or -1 if it was not found.
Parameters:
  source - the string to search for
Parameters:
  target - the array of zero or more strings in which tolook for source the index of target at which source first occurs, or -1if not found



objectEquals
final public static boolean objectEquals(Object source, Object target)(Code)
Convenience utility. Does null checks on objects, then calls equals.



parseChar
public static boolean parseChar(String id, int[] pos, char ch)(Code)
Parse a single non-whitespace character 'ch', optionally preceded by whitespace.
Parameters:
  id - the string to be parsed
Parameters:
  pos - INPUT-OUTPUT parameter. On input, pos[0] is theoffset of the first character to be parsed. On output, pos[0]is the index after the last parsed character. If the parsefails, pos[0] will be unchanged.
Parameters:
  ch - the non-whitespace character to be parsed. true if 'ch' is seen preceded by zero or morewhitespace characters.



parseInteger
public static int parseInteger(String rule, int[] pos, int limit)(Code)
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.
Parameters:
  pos - INPUT-OUTPUT parameter. On input, the firstcharacter to parse. On output, the character after the lastparsed character.



parseNumber
public static int parseNumber(String text, int[] pos, int radix)(Code)
Parse an unsigned 31-bit integer at the given offset. Use UCharacter.digit() to parse individual characters into digits.
Parameters:
  text - the text to be parsed
Parameters:
  pos - INPUT-OUTPUT parameter. On entry, pos[0] is theoffset within text at which to start parsing; it should pointto a valid digit. On exit, pos[0] is the offset after the lastparsed character. If the parse failed, it will be unchanged onexit. Must be >= 0 on entry.
Parameters:
  radix - the radix in which to parse; must be >= 2 and <=36. a non-negative parsed number, or -1 upon parse failure.Parse fails if there are no digits, that is, if pos[0] does notpoint to a valid digit on entry, or if the number to be parseddoes not fit into a 31-bit unsigned integer.



parsePattern
public static int parsePattern(String rule, int pos, int limit, String pattern, int[] parsedInts)(Code)
Parse a pattern string starting at offset pos. Keywords are matched case-insensitively. Spaces may be skipped and may be optional or required. Integer values may be parsed, and if they are, they will be returned in the given array. If successful, the offset of the next non-space character is returned. On failure, -1 is returned.
Parameters:
  pattern - must only contain lowercase characters, whichwill match their uppercase equivalents as well. A spacecharacter matches one or more required spaces. A '~' charactermatches zero or more optional spaces. A '#' character matchesan integer and stores it in parsedInts, which the caller mustensure has enough capacity.
Parameters:
  parsedInts - array to receive parsed integers. Callermust ensure that parsedInts.length is >= the number of '#'signs in 'pattern'. the position after the last character parsed, or -1 ifthe parse failed



parsePattern
public static int parsePattern(String pat, Replaceable text, int index, int limit)(Code)
Parse a pattern string within the given Replaceable and a parsing pattern. Characters are matched literally and case-sensitively except for the following special characters: ~ zero or more uprv_isRuleWhiteSpace chars If end of pattern is reached with all matches along the way, pos is advanced to the first unparsed index and returned. Otherwise -1 is returned.
Parameters:
  pat - pattern that controls parsing
Parameters:
  text - text to be parsed, starting at index
Parameters:
  index - offset to first character to parse
Parameters:
  limit - offset after last character to parse index after last parsed character, or -1 on parse failure.



parseUnicodeIdentifier
public static String parseUnicodeIdentifier(String str, int[] pos)(Code)
Parse a Unicode identifier from the given string at the given position. Return the identifier, or null if there is no identifier.
Parameters:
  str - the string to parse
Parameters:
  pos - INPUT-OUPUT parameter. On INPUT, pos[0] is thefirst character to examine. It must be less than str.length(),and it must not point to a whitespace character. That is, musthave pos[0] < str.length() and!UCharacterProperty.isRuleWhiteSpace(UTF16.charAt(str, pos[0])). OnOUTPUT, the position after the last parsed character. the Unicode identifier, or null if there is no valididentifier at pos[0].



quotedIndexOf
public static int quotedIndexOf(String text, int start, int limit, String setOfChars)(Code)
Returns the index of the first character in a set, ignoring quoted text. For example, in the string "abc'hide'h", the 'h' in "hide" will not be found by a search for "h". Unlike String.indexOf(), this method searches not for a single character, but for any character of the string setOfChars.
Parameters:
  text - text to be searched
Parameters:
  start - the beginning index, inclusive; 0 <= start<= limit.
Parameters:
  limit - the ending index, exclusive; start <= limit<= text.length().
Parameters:
  setOfChars - string with one or more distinct characters Offset of the first character in setOfCharsfound, or -1 if not found.
See Also:   String.indexOf



repeat
public static String repeat(String s, int count)(Code)
Utility to duplicate a string count times
Parameters:
  s -
Parameters:
  count -



replaceAll
public static String replaceAll(String src, String target, String replacement)(Code)



skipWhitespace
public static int skipWhitespace(String str, int pos)(Code)
Skip over a sequence of zero or more white space characters at pos. Return the index of the first non-white-space character at or after pos, or str.length(), if there is none.



skipWhitespace
public static void skipWhitespace(String str, int[] pos)(Code)
Skip over a sequence of zero or more white space characters at pos[0], advancing it.



split
public static void split(String s, char divider, String[] output)(Code)
Split a string into pieces based on the given divider character
Parameters:
  s - the string to split
Parameters:
  divider - the character on which to split. Occurrences ofthis character are not included in the output
Parameters:
  output - an array to receive the substrings betweeninstances of divider. It must be large enough on entry toaccomodate all output. Adjacent instances of the dividercharacter will place empty strings into output. Beforereturning, output is padded out with empty strings.



split
public static String[] split(String s, char divider)(Code)
Split a string into pieces based on the given divider character
Parameters:
  s - the string to split
Parameters:
  divider - the character on which to split. Occurrences ofthis character are not included in the output output an array to receive the substrings betweeninstances of divider. Adjacent instances of the dividercharacter will place empty strings into output.



trim
public static StringBuffer trim(StringBuffer b)(Code)
Trim whitespace from ends of a StringBuffer.



unescape
public static String unescape(String s)(Code)
Convert all escapes in a given string using unescapeAt().
exception:
  IllegalArgumentException - if an invalid escape isseen.



unescapeAt
public static int unescapeAt(String s, int[] offset16)(Code)
Convert an escape to a 32-bit code point value. We attempt to parallel the icu4c unescapeAt() function.
Parameters:
  offset16 - an array containing offset to the characterafter the backslash. Upon return offset16[0] willbe updated to point after the escape sequence. character value from 0 to 10FFFF, or -1 on error.



unescapeLeniently
public static String unescapeLeniently(String s)(Code)
Convert all escapes in a given string using unescapeAt(). Leave invalid escape sequences unchanged.



valueOf
public static String valueOf(int[] source)(Code)
Utility method to take a int[] containing codepoints and return a string representation with code units.



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.