@@ -47,6 +47,8 @@ public JsonStringEncoder() { }
47
47
/**
48
48
* Factory method for getting an instance; this is either recycled per-thread instance,
49
49
* or a newly constructed one.
50
+ *
51
+ * @return Static stateless encoder instance
50
52
*/
51
53
public static JsonStringEncoder getInstance () {
52
54
return instance ;
@@ -59,8 +61,12 @@ public static JsonStringEncoder getInstance() {
59
61
*/
60
62
61
63
/**
62
- * Method that will quote text contents using JSON standard quoting,
63
- * and return results as a character array
64
+ * Method that will escape text contents using JSON standard escaping,
65
+ * and return results as a character array.
66
+ *
67
+ * @param input Value String to process
68
+ *
69
+ * @return JSON-escaped String matching {@code input}
64
70
*/
65
71
public char [] quoteAsString (String input )
66
72
{
@@ -131,6 +137,10 @@ public char[] quoteAsString(String input)
131
137
/**
132
138
* Overloaded variant of {@link #quoteAsString(String)}.
133
139
*
140
+ * @param input Value {@link CharSequence} to process
141
+ *
142
+ * @return JSON-escaped String matching {@code input}
143
+ *
134
144
* @since 2.10
135
145
*/
136
146
public char [] quoteAsString (CharSequence input )
@@ -210,6 +220,9 @@ public char[] quoteAsString(CharSequence input)
210
220
* and append results to a supplied {@link StringBuilder}.
211
221
* Use this variant if you have e.g. a {@link StringBuilder} and want to avoid superfluous copying of it.
212
222
*
223
+ * @param input Value {@link CharSequence} to process
224
+ * @param output {@link StringBuilder} to append escaped contents to
225
+ *
213
226
* @since 2.8
214
227
*/
215
228
public void quoteAsString (CharSequence input , StringBuilder output )
@@ -247,8 +260,13 @@ public void quoteAsString(CharSequence input, StringBuilder output)
247
260
}
248
261
249
262
/**
250
- * Will quote given JSON String value using standard quoting, encode
251
- * results as UTF-8, and return result as a byte array.
263
+ * Method that will escape text contents using JSON standard escaping,
264
+ * encode resulting String as UTF-8 bytes
265
+ * and return results as a byte array.
266
+ *
267
+ * @param text Value {@link String} to process
268
+ *
269
+ * @return UTF-8 encoded bytes of JSON-escaped {@code text}
252
270
*/
253
271
@ SuppressWarnings ("resource" )
254
272
public byte [] quoteAsUTF8 (String text )
@@ -349,8 +367,12 @@ public byte[] quoteAsUTF8(String text)
349
367
}
350
368
351
369
/**
352
- * Will encode given String as UTF-8 (without any quoting), return
353
- * resulting byte array.
370
+ * Will encode given String as UTF-8 (without any escaping) and return
371
+ * the resulting byte array.
372
+ *
373
+ * @param text Value {@link String} to process
374
+ *
375
+ * @return UTF-8 encoded bytes of {@code text} (without any escaping)
354
376
*/
355
377
@ SuppressWarnings ("resource" )
356
378
public byte [] encodeAsUTF8 (String text )
@@ -447,6 +469,10 @@ public byte[] encodeAsUTF8(String text)
447
469
/**
448
470
* Overloaded variant of {@link #encodeAsUTF8(String)}.
449
471
*
472
+ * @param text Value {@link CharSequence} to process
473
+ *
474
+ * @return UTF-8 encoded bytes of {@code text} (without any escaping)
475
+ *
450
476
* @since 2.11
451
477
*/
452
478
@ SuppressWarnings ("resource" )
0 commit comments