Build AsminVoicechat / prepare-release (push) Successful in 14s
Build AsminVoicechat / build-and-test (17) (push) Canceled after 0s
Build AsminVoicechat / build-and-test (18) (push) Canceled after 0s
Build AsminVoicechat / build-and-test (19) (push) Canceled after 0s
Build AsminVoicechat / build-and-test (20) (push) Canceled after 0s
Build AsminVoicechat / build-and-test (21) (push) Canceled after 0s
Build AsminVoicechat / build-and-test (22) (push) Canceled after 0s
Build AsminVoicechat / build-and-test (23) (push) Canceled after 0s
Build AsminVoicechat / build-and-test (24) (push) Canceled after 0s
Build AsminVoicechat / build-and-test (25) (push) Canceled after 0s
Build AsminVoicechat / build-and-test (26) (push) Canceled after 0s
Build AsminVoicechat / build-and-test (27-ea) (push) Canceled after 0s
Build AsminVoicechat / build-and-test (16) (push) Canceled after 38s
197 lines
6.6 KiB
Java
197 lines
6.6 KiB
Java
/*
|
|
* Decompiled with CFR 0.152.
|
|
*/
|
|
package de.maxhenkel.voicechat.org.json;
|
|
|
|
import de.maxhenkel.voicechat.org.json.JSONArray;
|
|
import de.maxhenkel.voicechat.org.json.JSONException;
|
|
import de.maxhenkel.voicechat.org.json.JSONObject;
|
|
import de.maxhenkel.voicechat.org.json.JSONTokener;
|
|
|
|
public class CDL {
|
|
@Deprecated
|
|
public CDL() {
|
|
}
|
|
|
|
private static String getValue(JSONTokener x, char delimiter) throws JSONException {
|
|
char c;
|
|
while ((c = x.next()) == ' ' || c == '\t') {
|
|
}
|
|
if (c == '\u0000') {
|
|
return null;
|
|
}
|
|
if (c == '\"' || c == '\'') {
|
|
char q = c;
|
|
StringBuilder sb = new StringBuilder();
|
|
while (true) {
|
|
char nextC;
|
|
if ((c = x.next()) == q && (nextC = x.next()) != '\"') {
|
|
if (nextC <= '\u0000') break;
|
|
x.back();
|
|
break;
|
|
}
|
|
if (c == '\u0000' || c == '\n' || c == '\r') {
|
|
throw x.syntaxError("Missing close quote '" + q + "'.");
|
|
}
|
|
sb.append(c);
|
|
}
|
|
return sb.toString();
|
|
}
|
|
if (c == delimiter) {
|
|
x.back();
|
|
return "";
|
|
}
|
|
x.back();
|
|
return x.nextTo(delimiter);
|
|
}
|
|
|
|
public static JSONArray rowToJSONArray(JSONTokener x) throws JSONException {
|
|
return CDL.rowToJSONArray(x, ',');
|
|
}
|
|
|
|
public static JSONArray rowToJSONArray(JSONTokener x, char delimiter) throws JSONException {
|
|
JSONArray ja = new JSONArray();
|
|
block0: while (true) {
|
|
String value = CDL.getValue(x, delimiter);
|
|
char c = x.next();
|
|
if (value != null) {
|
|
ja.put(value);
|
|
} else {
|
|
if (ja.length() == 0 && c != delimiter) {
|
|
return null;
|
|
}
|
|
ja.put("");
|
|
}
|
|
while (true) {
|
|
if (c == delimiter) continue block0;
|
|
if (c != ' ') {
|
|
if (c == '\n' || c == '\r' || c == '\u0000') {
|
|
return ja;
|
|
}
|
|
throw x.syntaxError("Bad character '" + c + "' (" + c + ").");
|
|
}
|
|
c = x.next();
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
|
|
public static JSONObject rowToJSONObject(JSONArray names, JSONTokener x) throws JSONException {
|
|
return CDL.rowToJSONObject(names, x, ',');
|
|
}
|
|
|
|
public static JSONObject rowToJSONObject(JSONArray names, JSONTokener x, char delimiter) throws JSONException {
|
|
JSONArray ja = CDL.rowToJSONArray(x, delimiter);
|
|
return ja != null ? ja.toJSONObject(names) : null;
|
|
}
|
|
|
|
public static String rowToString(JSONArray ja) {
|
|
return CDL.rowToString(ja, ',');
|
|
}
|
|
|
|
public static String rowToString(JSONArray ja, char delimiter) {
|
|
StringBuilder sb = new StringBuilder();
|
|
for (int i = 0; i < ja.length(); ++i) {
|
|
Object object;
|
|
if (i > 0) {
|
|
sb.append(delimiter);
|
|
}
|
|
if ((object = ja.opt(i)) == null) continue;
|
|
String string = object.toString();
|
|
if (!(string.isEmpty() || string.indexOf(delimiter) < 0 && string.indexOf(10) < 0 && string.indexOf(13) < 0 && string.indexOf(0) < 0 && string.charAt(0) != '\"')) {
|
|
sb.append('\"');
|
|
int length = string.length();
|
|
for (int j = 0; j < length; ++j) {
|
|
char c = string.charAt(j);
|
|
if (c < ' ' || c == '\"') continue;
|
|
sb.append(c);
|
|
}
|
|
sb.append('\"');
|
|
continue;
|
|
}
|
|
sb.append(string);
|
|
}
|
|
sb.append('\n');
|
|
return sb.toString();
|
|
}
|
|
|
|
public static JSONArray toJSONArray(String string) throws JSONException {
|
|
return CDL.toJSONArray(string, ',');
|
|
}
|
|
|
|
public static JSONArray toJSONArray(String string, char delimiter) throws JSONException {
|
|
return CDL.toJSONArray(new JSONTokener(string), delimiter);
|
|
}
|
|
|
|
public static JSONArray toJSONArray(JSONTokener x) throws JSONException {
|
|
return CDL.toJSONArray(x, ',');
|
|
}
|
|
|
|
public static JSONArray toJSONArray(JSONTokener x, char delimiter) throws JSONException {
|
|
return CDL.toJSONArray(CDL.rowToJSONArray(x, delimiter), x, delimiter);
|
|
}
|
|
|
|
public static JSONArray toJSONArray(JSONArray names, String string) throws JSONException {
|
|
return CDL.toJSONArray(names, string, ',');
|
|
}
|
|
|
|
public static JSONArray toJSONArray(JSONArray names, String string, char delimiter) throws JSONException {
|
|
return CDL.toJSONArray(names, new JSONTokener(string), delimiter);
|
|
}
|
|
|
|
public static JSONArray toJSONArray(JSONArray names, JSONTokener x) throws JSONException {
|
|
return CDL.toJSONArray(names, x, ',');
|
|
}
|
|
|
|
public static JSONArray toJSONArray(JSONArray names, JSONTokener x, char delimiter) throws JSONException {
|
|
String key;
|
|
JSONObject j;
|
|
JSONObject jo;
|
|
if (names == null || names.length() == 0) {
|
|
return null;
|
|
}
|
|
JSONArray ja = new JSONArray();
|
|
while ((jo = CDL.rowToJSONObject(names, x, delimiter)) != null) {
|
|
ja.put(jo);
|
|
}
|
|
if (ja.length() == 0) {
|
|
return null;
|
|
}
|
|
if (ja.length() == 1 && (j = ja.getJSONObject(0)).length() == 1 && "".equals(key = j.keys().next()) && "".equals(j.get(key))) {
|
|
return null;
|
|
}
|
|
return ja;
|
|
}
|
|
|
|
public static String toString(JSONArray ja) throws JSONException {
|
|
return CDL.toString(ja, ',');
|
|
}
|
|
|
|
public static String toString(JSONArray ja, char delimiter) throws JSONException {
|
|
JSONArray names;
|
|
JSONObject jo = ja.optJSONObject(0);
|
|
if (jo != null && (names = jo.names()) != null) {
|
|
return CDL.rowToString(names, delimiter) + CDL.toString(names, ja, delimiter);
|
|
}
|
|
return null;
|
|
}
|
|
|
|
public static String toString(JSONArray names, JSONArray ja) throws JSONException {
|
|
return CDL.toString(names, ja, ',');
|
|
}
|
|
|
|
public static String toString(JSONArray names, JSONArray ja, char delimiter) throws JSONException {
|
|
if (names == null || names.length() == 0) {
|
|
return null;
|
|
}
|
|
StringBuilder sb = new StringBuilder();
|
|
for (int i = 0; i < ja.length(); ++i) {
|
|
JSONObject jo = ja.optJSONObject(i);
|
|
if (jo == null) continue;
|
|
sb.append(CDL.rowToString(jo.toJSONArray(names), delimiter));
|
|
}
|
|
return sb.toString();
|
|
}
|
|
}
|
|
|