MCPcopy Create free account
hub / github.com/M66B/FairEmail / tokenize

Method tokenize

app/src/main/java/com/sun/mail/smtp/DigestMD5.java:169–211  ·  view source on GitHub ↗

Tokenize a response from the server. @return Map containing key/value pairs from server

(String serverResponse)

Source from the content-addressed store, hash-verified

167 * @return Map containing key/value pairs from server
168 */
169 @SuppressWarnings("fallthrough")
170 private Map<String, String> tokenize(String serverResponse)
171 throws IOException {
172 Map<String, String> map = new HashMap<>();
173 byte[] bytes = serverResponse.getBytes("iso-8859-1"); // really ASCII?
174 String key = null;
175 int ttype;
176 StreamTokenizer tokens
177 = new StreamTokenizer(
178 new InputStreamReader(
179 new BASE64DecoderStream(
180 new ByteArrayInputStream(bytes, 4, bytes.length - 4)
181 ), "iso-8859-1" // really ASCII?
182 )
183 );
184
185 tokens.ordinaryChars('0', '9'); // reset digits
186 tokens.wordChars('0', '9'); // digits may start words
187 while ((ttype = tokens.nextToken()) != StreamTokenizer.TT_EOF) {
188 switch (ttype) {
189 case StreamTokenizer.TT_WORD:
190 if (key == null) {
191 key = tokens.sval;
192 break;
193 }
194 // fall-thru
195 case '"':
196 if (logger.isLoggable(Level.FINE))
197 logger.fine("Received => " +
198 key + "='" + tokens.sval + "'");
199 if (map.containsKey(key)) { // concatenate multiple values
200 map.put(key, map.get(key) + "," + tokens.sval);
201 } else {
202 map.put(key, tokens.sval);
203 }
204 key = null;
205 break;
206 default: // XXX - should never happen?
207 break;
208 }
209 }
210 return map;
211 }
212
213 private static char[] digits = {
214 '0', '1', '2', '3', '4', '5', '6', '7',

Callers 4

authClientMethod · 0.95
authServerMethod · 0.95
prism.jsFile · 0.80
oFunction · 0.80

Calls 7

fineMethod · 0.80
containsKeyMethod · 0.80
getBytesMethod · 0.45
nextTokenMethod · 0.45
isLoggableMethod · 0.45
putMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected