⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 httptokener.java

📁 json的JAVA实现,用于根据JAVA对象生成json string
💻 JAVA
字号:
package org.json;/*Copyright (c) 2002 JSON.orgPermission is hereby granted, free of charge, to any person obtaining a copyof this software and associated documentation files (the "Software"), to dealin the Software without restriction, including without limitation the rightsto use, copy, modify, merge, publish, distribute, sublicense, and/or sellcopies of the Software, and to permit persons to whom the Software isfurnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included in allcopies or substantial portions of the Software.The Software shall be used for Good, not Evil.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS ORIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THEAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHERLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THESOFTWARE.*//** * The HTTPTokener extends the JSONTokener to provide additional methods * for the parsing of HTTP headers. * @author JSON.org * @version 2 */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 JSONException     * @return A String.     */    public String nextToken() throws JSONException {        char c;        char q;        StringBuffer sb = new StringBuffer();        do {            c = next();        } while (Character.isWhitespace(c));        if (c == '"' || c == '\'') {            q = c;            for (;;) {                c = next();                if (c < ' ') {                    throw syntaxError("Unterminated string.");                }                if (c == q) {                    return sb.toString();                }                sb.append(c);            }        }         for (;;) {            if (c == 0 || Character.isWhitespace(c)) {                return sb.toString();            }            sb.append(c);            c = next();        }    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -