Lines Matching refs:Encoding

40   private static final Map<Integer, Encoding> defaultEncodings;
42 Map<Integer, Encoding> map = new LinkedHashMap<>();
43 map.put( 0x0, Encoding.PERCENT); // Null character
44 map.put( 0x1, Encoding.PERCENT); // Start of Header
45 map.put( 0x2, Encoding.PERCENT); // Start of Text
46 map.put( 0x3, Encoding.PERCENT); // End of Text
47 map.put( 0x4, Encoding.PERCENT); // End of Transmission
48 map.put( 0x5, Encoding.PERCENT); // Enquiry
49 map.put( 0x6, Encoding.PERCENT); // Acknowledgment
50 map.put( 0x7, Encoding.PERCENT); // Bell
51 map.put((int) '\b', Encoding.PERCENT); // Backspace
52 map.put((int) '\t', Encoding.SKIP); // Horizontal Tab
53 map.put((int) '\n', Encoding.SKIP); // Line feed
54 map.put( 0xb, Encoding.PERCENT); // Vertical Tab
55 map.put((int) '\f', Encoding.SKIP); // Form feed
56 map.put((int) '\r', Encoding.SKIP); // Carriage return
57 map.put( 0xe, Encoding.PERCENT); // Shift Out
58 map.put( 0xf, Encoding.PERCENT); // Shift In
59 map.put( 0x10, Encoding.PERCENT); // Data Link Escape
60 map.put( 0x11, Encoding.PERCENT); // Device Control 1 (oft. XON)
61 map.put( 0x12, Encoding.PERCENT); // Device Control 2
62 map.put( 0x13, Encoding.PERCENT); // Device Control 3 (oft. XOFF)
63 map.put( 0x14, Encoding.PERCENT); // Device Control 4
64 map.put( 0x15, Encoding.PERCENT); // Negative Acknowledgment
65 map.put( 0x16, Encoding.PERCENT); // Synchronous idle
66 map.put( 0x17, Encoding.PERCENT); // End of Transmission Block
67 map.put( 0x18, Encoding.PERCENT); // Cancel
68 map.put( 0x19, Encoding.PERCENT); // End of Medium
69 map.put( 0x1a, Encoding.PERCENT); // Substitute
70 map.put( 0x1b, Encoding.PERCENT); // Escape
71 map.put( 0x1c, Encoding.PERCENT); // File Separator
72 map.put( 0x1d, Encoding.PERCENT); // Group Separator
73 map.put( 0x1e, Encoding.PERCENT); // Record Separator
74 map.put( 0x1f, Encoding.PERCENT); // Unit Separator
75 map.put((int) ' ', Encoding.PERCENT);
76 map.put((int) '!', Encoding.IDENTITY);
77 map.put((int) '"', Encoding.PERCENT);
78 map.put((int) '#', Encoding.PERCENT);
79 map.put((int) '$', Encoding.IDENTITY);
80 map.put((int) '%', Encoding.IDENTITY);
81 map.put((int) '&', Encoding.IDENTITY);
82 map.put((int) '\'', Encoding.IDENTITY);
83 map.put((int) '(', Encoding.IDENTITY);
84 map.put((int) ')', Encoding.IDENTITY);
85 map.put((int) '*', Encoding.IDENTITY);
86 map.put((int) '+', Encoding.IDENTITY);
87 map.put((int) ',', Encoding.IDENTITY);
88 map.put((int) '-', Encoding.IDENTITY);
89 map.put((int) '.', Encoding.IDENTITY);
90 map.put((int) '/', Encoding.IDENTITY);
91 map.put((int) '0', Encoding.IDENTITY);
92 map.put((int) '1', Encoding.IDENTITY);
93 map.put((int) '2', Encoding.IDENTITY);
94 map.put((int) '3', Encoding.IDENTITY);
95 map.put((int) '4', Encoding.IDENTITY);
96 map.put((int) '5', Encoding.IDENTITY);
97 map.put((int) '6', Encoding.IDENTITY);
98 map.put((int) '7', Encoding.IDENTITY);
99 map.put((int) '8', Encoding.IDENTITY);
100 map.put((int) '9', Encoding.IDENTITY);
101 map.put((int) ':', Encoding.IDENTITY);
102 map.put((int) ';', Encoding.IDENTITY);
103 map.put((int) '<', Encoding.PERCENT);
104 map.put((int) '=', Encoding.IDENTITY);
105 map.put((int) '>', Encoding.PERCENT);
106 map.put((int) '?', Encoding.PERCENT);
107 map.put((int) '@', Encoding.IDENTITY);
108 map.put((int) 'A', Encoding.IDENTITY);
109 map.put((int) 'B', Encoding.IDENTITY);
110 map.put((int) 'C', Encoding.IDENTITY);
111 map.put((int) 'D', Encoding.IDENTITY);
112 map.put((int) 'E', Encoding.IDENTITY);
113 map.put((int) 'F', Encoding.IDENTITY);
114 map.put((int) 'G', Encoding.IDENTITY);
115 map.put((int) 'H', Encoding.IDENTITY);
116 map.put((int) 'I', Encoding.IDENTITY);
117 map.put((int) 'J', Encoding.IDENTITY);
118 map.put((int) 'K', Encoding.IDENTITY);
119 map.put((int) 'L', Encoding.IDENTITY);
120 map.put((int) 'M', Encoding.IDENTITY);
121 map.put((int) 'N', Encoding.IDENTITY);
122 map.put((int) 'O', Encoding.IDENTITY);
123 map.put((int) 'P', Encoding.IDENTITY);
124 map.put((int) 'Q', Encoding.IDENTITY);
125 map.put((int) 'R', Encoding.IDENTITY);
126 map.put((int) 'S', Encoding.IDENTITY);
127 map.put((int) 'T', Encoding.IDENTITY);
128 map.put((int) 'U', Encoding.IDENTITY);
129 map.put((int) 'V', Encoding.IDENTITY);
130 map.put((int) 'W', Encoding.IDENTITY);
131 map.put((int) 'X', Encoding.IDENTITY);
132 map.put((int) 'Y', Encoding.IDENTITY);
133 map.put((int) 'Z', Encoding.IDENTITY);
134 map.put((int) '[', Encoding.IDENTITY);
135 map.put((int) '\\', Encoding.IDENTITY);
136 map.put((int) ']', Encoding.IDENTITY);
137 map.put((int) '^', Encoding.IDENTITY);
138 map.put((int) '_', Encoding.IDENTITY);
139 map.put((int) '`', Encoding.PERCENT);
140 map.put((int) 'a', Encoding.IDENTITY);
141 map.put((int) 'b', Encoding.IDENTITY);
142 map.put((int) 'c', Encoding.IDENTITY);
143 map.put((int) 'd', Encoding.IDENTITY);
144 map.put((int) 'e', Encoding.IDENTITY);
145 map.put((int) 'f', Encoding.IDENTITY);
146 map.put((int) 'g', Encoding.IDENTITY);
147 map.put((int) 'h', Encoding.IDENTITY);
148 map.put((int) 'i', Encoding.IDENTITY);
149 map.put((int) 'j', Encoding.IDENTITY);
150 map.put((int) 'k', Encoding.IDENTITY);
151 map.put((int) 'l', Encoding.IDENTITY);
152 map.put((int) 'm', Encoding.IDENTITY);
153 map.put((int) 'n', Encoding.IDENTITY);
154 map.put((int) 'o', Encoding.IDENTITY);
155 map.put((int) 'p', Encoding.IDENTITY);
156 map.put((int) 'q', Encoding.IDENTITY);
157 map.put((int) 'r', Encoding.IDENTITY);
158 map.put((int) 's', Encoding.IDENTITY);
159 map.put((int) 't', Encoding.IDENTITY);
160 map.put((int) 'u', Encoding.IDENTITY);
161 map.put((int) 'v', Encoding.IDENTITY);
162 map.put((int) 'w', Encoding.IDENTITY);
163 map.put((int) 'x', Encoding.IDENTITY);
164 map.put((int) 'y', Encoding.IDENTITY);
165 map.put((int) 'z', Encoding.IDENTITY);
166 map.put((int) '{', Encoding.IDENTITY);
167 map.put((int) '|', Encoding.IDENTITY);
168 map.put((int) '}', Encoding.IDENTITY);
169 map.put((int) '~', Encoding.IDENTITY);
170 map.put( 0x7f, Encoding.PERCENT); // Delete
171 map.put( UNICODE_2, Encoding.PERCENT);
172 map.put( UNICODE_3, Encoding.PERCENT);
173 map.put( UNICODE_4, Encoding.PERCENT);
177 private final Map<Integer, Encoding> encodings;
184 public UrlComponentEncodingTester override(Encoding encoding, int... codePoints) {
192 encodings.put(UNICODE_2, Encoding.IDENTITY);
193 encodings.put(UNICODE_3, Encoding.IDENTITY);
194 encodings.put(UNICODE_4, Encoding.IDENTITY);
208 for (Map.Entry<Integer, Encoding> entry : encodings.entrySet()) {
209 Encoding encoding = entry.getValue();
212 if (encoding == Encoding.SKIP) continue;
221 Encoding.IDENTITY.encode(codePoint)) != -1;
228 private void testParseAlreadyEncoded(int codePoint, Encoding encoding, Component component) {
233 fail(String.format("Encoding %s %#x using %s", component, codePoint, encoding));
238 String expected = Encoding.IDENTITY.encode(codePoint);
248 private void testParseOriginal(int codePoint, Encoding encoding, Component component) {
250 if (encoding != Encoding.PERCENT) return;
251 String identity = Encoding.IDENTITY.encode(codePoint);
257 fail(String.format("Encoding %s %#02x using %s", component, codePoint, encoding));
261 private void testToUrl(int codePoint, Encoding encoding, Component component) {
266 fail(String.format("Encoding %s %#x using %s", component, codePoint, encoding));
270 private void testFromUrl(int codePoint, Encoding encoding, Component component) {
275 fail(String.format("Encoding %s %#x using %s", component, codePoint, encoding));
280 int codePoint, Encoding encoding, Component component, boolean uriEscaped) {
289 fail(String.format("Encoding %s %#x using %s", component, codePoint, encoding));
292 fail(String.format("Encoding %s %#x using %s", component, codePoint, encoding));
297 fail(String.format("Encoding %s %#x using %s", component, codePoint, encoding));
300 fail(String.format("Encoding %s %#x using %s", component, codePoint, encoding));
305 public enum Encoding {