001: /* ====================================================================
002: The Jicarilla Software License
003:
004: Copyright (c) 2003 Leo Simons.
005: All rights reserved.
006:
007: Permission is hereby granted, free of charge, to any person obtaining
008: a copy of this software and associated documentation files (the
009: "Software"), to deal in the Software without restriction, including
010: without limitation the rights to use, copy, modify, merge, publish,
011: distribute, sublicense, and/or sell copies of the Software, and to
012: permit persons to whom the Software is furnished to do so, subject to
013: the following conditions:
014:
015: The above copyright notice and this permission notice shall be
016: included in all copies or substantial portions of the Software.
017:
018: THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
019: EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
020: MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
021: IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
022: CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
023: TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
024: SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
025: ==================================================================== */
026: package org.jicarilla.http.util;
027:
028: import java.util.Arrays;
029:
030: /**
031: * Provides a list of the chars in Iso646 (US ASCII), and convenience
032: * arrays containing the chars in that spec which form some special
033: * group.
034: *
035: * @author <a href="mailto: lsimons at jicarilla dot org">Leo Simons</a>
036: * @version $Id: Iso646.java,v 1.2 2004/01/04 16:10:17 lsimons Exp $
037: */
038: public class Iso646 {
039: public final static char NULL = (char) 0x00; // U+0000
040: public final static char START_OF_HEADING = (char) 0x01; // U+0001
041: public final static char START_OF_TEXT = (char) 0x02; // U+0002
042: public final static char END_OF_TEXT = (char) 0x03; // U+0003
043: public final static char END_OF_TRANSMISSION = (char) 0x04; // U+0004
044: public final static char ENQUIRY = (char) 0x05; // U+0005
045: public final static char ACKNOWLEDGE = (char) 0x06; // U+0006
046: public final static char BELL = (char) 0x07; // U+0007
047: public final static char BACKSPACE = (char) 0x08; // U+0008
048: public final static char HORIZONTAL_TABULATION = (char) 0x09; // U+0009
049: public final static char LINE_FEED = (char) 0x0A; // U+000A
050: public final static char VERTICAL_TABULATION = (char) 0x0B; // U+000B
051: public final static char FORM_FEED = (char) 0x0C; // U+000C
052: public final static char CARRIAGE_RETURN = (char) 0x0D; // U+000D
053: public final static char SHIFT_OUT = (char) 0x0E; // U+000E
054: public final static char SHIFT_IN = (char) 0x0F; // U+000F
055: public final static char DATA_LINK_ESCAPE = (char) 0x10; // U+0010
056: public final static char DEVICE_CONTROL_ONE = (char) 0x11; // U+0011
057: public final static char DEVICE_CONTROL_TWO = (char) 0x12; // U+0012
058: public final static char DEVICE_CONTROL_THREE = (char) 0x13; // U+0013
059: public final static char DEVICE_CONTROL_FOUR = (char) 0x14; // U+0014
060: public final static char NEGATIVE_ACKNOWLEDGE = (char) 0x15; // U+0015
061: public final static char SYNCHRONOUS_IDLE = (char) 0x16; // U+0016
062: public final static char END_OF_TRANSMISSION_BLOCK = (char) 0x17; // U+0017
063: public final static char CANCEL = (char) 0x18; // U+0018
064: public final static char END_OF_MEDIUM = (char) 0x19; // U+0019
065: public final static char SUBSTITUTE = (char) 0x1A; // U+001A
066: public final static char ESCAPE = (char) 0x1B; // U+001B
067: public final static char FILE_SEPARATOR = (char) 0x1C; // U+001C
068: public final static char GROUP_SEPARATOR = (char) 0x1D; // U+001D
069: public final static char RECORD_SEPARATOR = (char) 0x1E; // U+001E
070: public final static char UNIT_SEPARATOR = (char) 0x1F; // U+001F
071: public final static char SPACE = (char) 0x20; // U+0020
072: public final static char EXCLAMATION_MARK = (char) 0x21; // U+0021
073: public final static char QUOTATION_MARK = (char) 0x22; // U+0022
074: public final static char NUMBER_SIGN = (char) 0x23; // U+0023
075: public final static char DOLLAR_SIGN = (char) 0x24; // U+0024
076: public final static char PERCENT_SIGN = (char) 0x25; // U+0025
077: public final static char AMPERSAND = (char) 0x26; // U+0026
078: public final static char APOSTROPHE = (char) 0x27; // U+0027
079: public final static char LEFT_PARENTHESIS = (char) 0x28; // U+0028
080: public final static char RIGHT_PARENTHESIS = (char) 0x29; // U+0029
081: public final static char ASTERISK = (char) 0x2A; // U+002A
082: public final static char PLUS_SIGN = (char) 0x2B; // U+002B
083: public final static char COMMA = (char) 0x2C; // U+002C
084: public final static char HYPHEN_MINUS = (char) 0x2D; // U+002D
085: public final static char FULL_STOP = (char) 0x2E; // U+002E
086: public final static char SOLIDUS = (char) 0x2F; // U+002F
087: public final static char DIGIT_ZERO = (char) 0x30; // U+0030
088: public final static char DIGIT_ONE = (char) 0x31; // U+0031
089: public final static char DIGIT_TWO = (char) 0x32; // U+0032
090: public final static char DIGIT_THREE = (char) 0x33; // U+0033
091: public final static char DIGIT_FOUR = (char) 0x34; // U+0034
092: public final static char DIGIT_FIVE = (char) 0x35; // U+0035
093: public final static char DIGIT_SIX = (char) 0x36; // U+0036
094: public final static char DIGIT_SEVEN = (char) 0x37; // U+0037
095: public final static char DIGIT_EIGHT = (char) 0x38; // U+0038
096: public final static char DIGIT_NINE = (char) 0x39; // U+0039
097: public final static char COLON = (char) 0x3A; // U+003A
098: public final static char SEMICOLON = (char) 0x3B; // U+003B
099: public final static char LESS_THAN_SIGN = (char) 0x3C; // U+003C
100: public final static char EQUALS_SIGN = (char) 0x3D; // U+003D
101: public final static char GREATER_THAN_SIGN = (char) 0x3E; // U+003E
102: public final static char QUESTION_MARK = (char) 0x3F; // U+003F
103: public final static char COMMERCIAL_AT = (char) 0x40; // U+0040
104: public final static char LATIN_CAPITAL_LETTER_A = (char) 0x41; // U+0041
105: public final static char LATIN_CAPITAL_LETTER_B = (char) 0x42; // U+0042
106: public final static char LATIN_CAPITAL_LETTER_C = (char) 0x43; // U+0043
107: public final static char LATIN_CAPITAL_LETTER_D = (char) 0x44; // U+0044
108: public final static char LATIN_CAPITAL_LETTER_E = (char) 0x45; // U+0045
109: public final static char LATIN_CAPITAL_LETTER_F = (char) 0x46; // U+0046
110: public final static char LATIN_CAPITAL_LETTER_G = (char) 0x47; // U+0047
111: public final static char LATIN_CAPITAL_LETTER_H = (char) 0x48; // U+0048
112: public final static char LATIN_CAPITAL_LETTER_I = (char) 0x49; // U+0049
113: public final static char LATIN_CAPITAL_LETTER_J = (char) 0x4A; // U+004A
114: public final static char LATIN_CAPITAL_LETTER_K = (char) 0x4B; // U+004B
115: public final static char LATIN_CAPITAL_LETTER_L = (char) 0x4C; // U+004C
116: public final static char LATIN_CAPITAL_LETTER_M = (char) 0x4D; // U+004D
117: public final static char LATIN_CAPITAL_LETTER_N = (char) 0x4E; // U+004E
118: public final static char LATIN_CAPITAL_LETTER_O = (char) 0x4F; // U+004F
119: public final static char LATIN_CAPITAL_LETTER_P = (char) 0x50; // U+0050
120: public final static char LATIN_CAPITAL_LETTER_Q = (char) 0x51; // U+0051
121: public final static char LATIN_CAPITAL_LETTER_R = (char) 0x52; // U+0052
122: public final static char LATIN_CAPITAL_LETTER_S = (char) 0x53; // U+0053
123: public final static char LATIN_CAPITAL_LETTER_T = (char) 0x54; // U+0054
124: public final static char LATIN_CAPITAL_LETTER_U = (char) 0x55; // U+0055
125: public final static char LATIN_CAPITAL_LETTER_V = (char) 0x56; // U+0056
126: public final static char LATIN_CAPITAL_LETTER_W = (char) 0x57; // U+0057
127: public final static char LATIN_CAPITAL_LETTER_X = (char) 0x58; // U+0058
128: public final static char LATIN_CAPITAL_LETTER_Y = (char) 0x59; // U+0059
129: public final static char LATIN_CAPITAL_LETTER_Z = (char) 0x5A; // U+005A
130: public final static char LEFT_SQUARE_BRACKET = (char) 0x5B; // U+005B
131: public final static char REVERSE_SOLIDUS = (char) 0x5C; // U+005C
132: public final static char RIGHT_SQUARE_BRACKET = (char) 0x5D; // U+005D
133: public final static char CIRCUMFLEX_ACCENT = (char) 0x5E; // U+005E
134: public final static char LOW_LINE = (char) 0x5F; // U+005F
135: public final static char GRAVE_ACCENT = (char) 0x60; // U+0060
136: public final static char LATIN_SMALL_LETTER_A = (char) 0x61; // U+0061
137: public final static char LATIN_SMALL_LETTER_B = (char) 0x62; // U+0062
138: public final static char LATIN_SMALL_LETTER_C = (char) 0x63; // U+0063
139: public final static char LATIN_SMALL_LETTER_D = (char) 0x64; // U+0064
140: public final static char LATIN_SMALL_LETTER_E = (char) 0x65; // U+0065
141: public final static char LATIN_SMALL_LETTER_F = (char) 0x66; // U+0066
142: public final static char LATIN_SMALL_LETTER_G = (char) 0x67; // U+0067
143: public final static char LATIN_SMALL_LETTER_H = (char) 0x68; // U+0068
144: public final static char LATIN_SMALL_LETTER_I = (char) 0x69; // U+0069
145: public final static char LATIN_SMALL_LETTER_J = (char) 0x6A; // U+006A
146: public final static char LATIN_SMALL_LETTER_K = (char) 0x6B; // U+006B
147: public final static char LATIN_SMALL_LETTER_L = (char) 0x6C; // U+006C
148: public final static char LATIN_SMALL_LETTER_M = (char) 0x6D; // U+006D
149: public final static char LATIN_SMALL_LETTER_N = (char) 0x6E; // U+006E
150: public final static char LATIN_SMALL_LETTER_O = (char) 0x6F; // U+006F
151: public final static char LATIN_SMALL_LETTER_P = (char) 0x70; // U+0070
152: public final static char LATIN_SMALL_LETTER_Q = (char) 0x71; // U+0071
153: public final static char LATIN_SMALL_LETTER_R = (char) 0x72; // U+0072
154: public final static char LATIN_SMALL_LETTER_S = (char) 0x73; // U+0073
155: public final static char LATIN_SMALL_LETTER_T = (char) 0x74; // U+0074
156: public final static char LATIN_SMALL_LETTER_U = (char) 0x75; // U+0075
157: public final static char LATIN_SMALL_LETTER_V = (char) 0x76; // U+0076
158: public final static char LATIN_SMALL_LETTER_W = (char) 0x77; // U+0077
159: public final static char LATIN_SMALL_LETTER_X = (char) 0x78; // U+0078
160: public final static char LATIN_SMALL_LETTER_Y = (char) 0x79; // U+0079
161: public final static char LATIN_SMALL_LETTER_Z = (char) 0x7A; // U+007A
162: public final static char LEFT_CURLY_BRACKET = (char) 0x7B; // U+007B
163: public final static char VERTICAL_LINE = (char) 0x7C; // U+007C
164: public final static char RIGHT_CURLY_BRACKET = (char) 0x7D; // U+007D
165: public final static char TILDE = (char) 0x7E; // U+007E
166: public final static char DELETE = (char) 0x7F; // U+007F
167:
168: /** 0x00..0x7F */
169: public final static char[] CHAR;
170:
171: /** A..Z */
172: public final static char[] UPALPHA;
173:
174: /** a..z */
175: public final static char[] LOALPHA;
176:
177: /** A..Z | a..z */
178: public final static char[] ALPHA;
179:
180: /** 0..9 */
181: public final static char[] DIGIT;
182:
183: /** Control Characters (0x00-0x1F + 0X7F) */
184: public final static char[] CTL;
185:
186: static {
187: CHAR = new char[128];
188: for (int i = 0; i < CHAR.length; i++)
189: CHAR[i] = (char) i;
190: Arrays.sort(CHAR);
191:
192: UPALPHA = new char[26];
193: for (int i = 0; i < UPALPHA.length; i++)
194: UPALPHA[i] = CHAR[i + 0x41];
195: Arrays.sort(UPALPHA);
196:
197: LOALPHA = new char[26];
198: for (int i = 0; i < LOALPHA.length; i++)
199: LOALPHA[i] = CHAR[i + 0x61];
200: Arrays.sort(LOALPHA);
201:
202: ALPHA = new char[52];
203: for (int i = 0; i < UPALPHA.length; i++)
204: ALPHA[i] = UPALPHA[i];
205: for (int i = 0; i < LOALPHA.length; i++)
206: ALPHA[26 + i] = LOALPHA[i];
207: Arrays.sort(ALPHA);
208:
209: DIGIT = new char[10];
210: for (int i = 0; i < DIGIT.length; i++)
211: DIGIT[i] = CHAR[i + 0x30];
212: Arrays.sort(DIGIT);
213:
214: CTL = new char[33];
215: for (int i = 0; i < 33; i++)
216: CTL[i] = CHAR[i];
217: CTL[32] = DELETE;
218: Arrays.sort(CTL);
219: }
220:
221: }
|