Skip to content

Commit df32603

Browse files
committed
Rearrange write static methods in JSONWriter.
Make parameter order consistent. Also change quote() to writeString().
1 parent 1a73dd7 commit df32603

7 files changed

Lines changed: 249 additions & 193 deletions

‎JSONAppendable.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public interface JSONAppendable {
5454
* value {@code null}.
5555
* <p>
5656
* If a runtime exception is thrown, this will be caught and propagated
57-
* as a <code>JSONException</code>.</p>
57+
* as a {@code JSONException}.</p>
5858
*
5959
* @param appender an {@code Appendable} to which a strictly syntactically
6060
* correct JSON value must be written

‎JSONArray.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ public String join(String separator) throws JSONException {
460460
if (i > 0) {
461461
sb.append(separator);
462462
}
463-
JSONWriter.writeValue(sb, this.myArrayList.get(i));
463+
JSONWriter.writeValue(this.myArrayList.get(i), sb);
464464
}
465465
return sb.toString();
466466
}

‎JSONObject.java‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1466,7 +1466,7 @@ public Object optQuery(String jsonPointer) {
14661466
public static String quote(CharSequence string) {
14671467
StringBuilder sb = new StringBuilder();
14681468
try {
1469-
return JSONWriter.quote(string, sb).toString();
1469+
return JSONWriter.writeString(string, sb).toString();
14701470
} catch (IOException ignored) {
14711471
// will never happen - we are writing to a string builder
14721472
return "";
@@ -1491,7 +1491,7 @@ public static String quote(CharSequence string) {
14911491
* @throws IOException there was a problem writing to the Appendable
14921492
*/
14931493
public static <T extends Appendable> T quote(CharSequence string, T w) throws IOException {
1494-
return JSONWriter.quote(string, w);
1494+
return JSONWriter.writeString(string, w);
14951495
}
14961496

14971497
/**
@@ -1725,7 +1725,7 @@ public static String valueToString(Object value) throws JSONException {
17251725
return result;
17261726
}
17271727
} else {
1728-
result = JSONWriter.writeValue(new StringBuilder(), value).toString();
1728+
result = JSONWriter.writeValue(value, new StringBuilder()).toString();
17291729
}
17301730
return result;
17311731
}

‎JSONStrictTokener.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ public char nextClean() throws JSONException {
132132
* @return the Token type representing the next token type
133133
*/
134134
@Override
135-
public JSONToken nextTokenType() throws JSONException {
135+
public JSONTokener.JSONToken nextTokenType() throws JSONException {
136136
char c = nextClean();
137137

138138
switch(c) {

0 commit comments

Comments
 (0)