Source Code Cross Referenced for UCharacterUtility.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 Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         *******************************************************************************
003:         * Copyright (C) 1996-2004, International Business Machines Corporation and    *
004:         * others. All Rights Reserved.                                                *
005:         *******************************************************************************
006:         */package com.ibm.icu.impl;
007:
008:        /**
009:         * Internal character utility class for simple data type conversion and String 
010:         * parsing functions. Does not have an analog in the JDK.
011:         * @author Syn Wee Quek
012:         * @since sep2900
013:         */
014:
015:        public final class UCharacterUtility {
016:            // public methods -----------------------------------------------------
017:
018:            /**
019:             * Determines if codepoint is a non character
020:             * @param ch codepoint
021:             * @return true if codepoint is a non character false otherwise
022:             */
023:            public static boolean isNonCharacter(int ch) {
024:                if ((ch & NON_CHARACTER_SUFFIX_MIN_3_0_) == NON_CHARACTER_SUFFIX_MIN_3_0_) {
025:                    return true;
026:                }
027:
028:                return ch >= NON_CHARACTER_MIN_3_1_
029:                        && ch <= NON_CHARACTER_MAX_3_1_;
030:            }
031:
032:            // package private methods ---------------------------------------------
033:
034:            /**
035:             * joining 2 chars to form an int
036:             * @param msc most significant char
037:             * @param lsc least significant char
038:             * @return int form
039:             */
040:            static int toInt(char msc, char lsc) {
041:                return ((msc << 16) | lsc);
042:            }
043:
044:            /**
045:             * Retrieves a null terminated substring from an array of bytes.
046:             * Substring is a set of non-zero bytes starting from argument start to the 
047:             * next zero byte. If the first byte is a zero, the next byte will be taken as
048:             * the first byte.
049:             * @param str stringbuffer to store data in, data will be store with each
050:             *            byte as a char
051:             * @param array byte array
052:             * @param index to start substring in byte count
053:             * @return the end position of the substring within the character array
054:             */
055:            static int getNullTermByteSubString(StringBuffer str, byte[] array,
056:                    int index) {
057:                byte b = 1;
058:
059:                while (b != 0) {
060:                    b = array[index];
061:                    if (b != 0) {
062:                        str.append((char) (b & 0x00FF));
063:                    }
064:                    index++;
065:                }
066:                return index;
067:            }
068:
069:            /**
070:             * Compares a null terminated substring from an array of bytes.
071:             * Substring is a set of non-zero bytes starting from argument start to the 
072:             * next zero byte. if the first byte is a zero, the next byte will be taken as
073:             * the first byte.
074:             * @param str string to compare
075:             * @param array byte array
076:             * @param strindex index within str to start comparing
077:             * @param aindex array index to start in byte count
078:             * @return the end position of the substring within str if matches otherwise 
079:             *         a -1
080:             */
081:            static int compareNullTermByteSubString(String str, byte[] array,
082:                    int strindex, int aindex) {
083:                byte b = 1;
084:                int length = str.length();
085:
086:                while (b != 0) {
087:                    b = array[aindex];
088:                    aindex++;
089:                    if (b == 0) {
090:                        break;
091:                    }
092:                    // if we have reached the end of the string and yet the array has not 
093:                    // reached the end of their substring yet, abort
094:                    if (strindex == length
095:                            || (str.charAt(strindex) != (char) (b & 0xFF))) {
096:                        return -1;
097:                    }
098:                    strindex++;
099:                }
100:                return strindex;
101:            }
102:
103:            /**
104:             * Skip null terminated substrings from an array of bytes.
105:             * Substring is a set of non-zero bytes starting from argument start to the 
106:             * next zero byte. If the first byte is a zero, the next byte will be taken as
107:             * the first byte.
108:             * @param array byte array
109:             * @param index to start substrings in byte count
110:             * @param skipcount number of null terminated substrings to skip
111:             * @return the end position of the substrings within the character array
112:             */
113:            static int skipNullTermByteSubString(byte[] array, int index,
114:                    int skipcount) {
115:                byte b;
116:                for (int i = 0; i < skipcount; i++) {
117:                    b = 1;
118:                    while (b != 0) {
119:                        b = array[index];
120:                        index++;
121:                    }
122:                }
123:                return index;
124:            }
125:
126:            /**
127:             * skip substrings from an array of characters, where each character is a set 
128:             * of 2 bytes. substring is a set of non-zero bytes starting from argument 
129:             * start to the byte of the argument value. skips up to a max number of 
130:             * characters
131:             * @param array byte array to parse
132:             * @param index to start substrings in byte count
133:             * @param length the max number of bytes to skip
134:             * @param skipend value of byte to skip to
135:             * @return the number of bytes skipped
136:             */
137:            static int skipByteSubString(byte[] array, int index, int length,
138:                    byte skipend) {
139:                int result;
140:                byte b;
141:
142:                for (result = 0; result < length; result++) {
143:                    b = array[index + result];
144:                    if (b == skipend) {
145:                        result++;
146:                        break;
147:                    }
148:                }
149:
150:                return result;
151:            }
152:
153:            // private data member --------------------------------------------------
154:
155:            /**
156:             * Minimum suffix value that indicates if a character is non character.
157:             * Unicode 3.0 non characters
158:             */
159:            private static final int NON_CHARACTER_SUFFIX_MIN_3_0_ = 0xFFFE;
160:            /**
161:             * New minimum non character in Unicode 3.1
162:             */
163:            private static final int NON_CHARACTER_MIN_3_1_ = 0xFDD0;
164:            /**
165:             * New non character range in Unicode 3.1
166:             */
167:            private static final int NON_CHARACTER_MAX_3_1_ = 0xFDEF;
168:
169:            // private constructor --------------------------------------------------
170:
171:            ///CLOVER:OFF
172:            /**
173:             * private constructor to avoid initialisation
174:             */
175:            private UCharacterUtility() {
176:            }
177:            ///CLOVER:ON
178:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.