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

📄 jsonvalue.java

📁 一个extjs编写的代码
💻 JAVA
字号:
package anni.json;

import java.io.Writer;


public class JsonValue implements Json {
    public static final int TYPE_UNKNOWN = 0;
    public static final int TYPE_STRING = 1;
    public static final int TYPE_INT = 2;
    public static final int TYPE_FLOAT = 3;
    public static final int TYPE_BOOLEAN = 4;
    public static final int TYPE_UNDEFINED = 5;
    private int type;
    private Object data;

    public JsonValue() {
    }

    public JsonValue(Object data) {
        this.data = data;
    }

    public JsonValue(Object data, int type) {
        this.data = data;
        this.type = type;
    }

    public void write(Writer writer) {
        try {
            writer.flush();
        } catch (Exception ex) {
            System.err.println(ex);
        }
    }

    public String toString() {
        if (data == null) {
            return "null";
        } else {
            if ((type == TYPE_UNKNOWN) || (type == TYPE_STRING)) {
                return data.toString().replaceAll("\\\\", "\\\\\\\\")
                           .replaceAll("'", "\\\\'")
                           .replaceAll("\\\"", "\\\\\"");
            } else {
                return data.toString();
            }
        }
    }
}

⌨️ 快捷键说明

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