?? httptokener.java
字號:
package org.json;
import java.text.ParseException;
/**
* The HTTPTokener extends the JSONTokener to provide additional methods
* for the parsing of HTTP headers.
* <p>
* Public Domain 2002 JSON.org
* @author JSON.org
* @version 0.1
*/
public class HTTPTokener extends JSONTokener {
/**
* Construct an XMLTokener from a string.
* @param s A source string.
*/
public HTTPTokener(String s) {
super(s);
}
/**
* Get the next token or string. This is used in parsing HTTP headers.
* @throws ParseException
* @return A String.
*/
public String nextToken() throws ParseException {
char c;
char q;
StringBuffer sb = new StringBuffer();
do {
c = next();
} while (Character.isWhitespace(c));
if (c == '"' || c == '\'') {
q = c;
while (true) {
c = next();
if (c < ' ') {
throw syntaxError("Unterminated string.");
}
if (c == q) {
return sb.toString();
}
sb.append(c);
}
} else {
while (true) {
if (c == 0 || Character.isWhitespace(c)) {
return sb.toString();
}
sb.append(c);
c = next();
}
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -