Skip to content

Commit e5cbda2

Browse files
committed
More javadocing
1 parent 8dadf29 commit e5cbda2

File tree

4 files changed

+43
-8
lines changed

4 files changed

+43
-8
lines changed

src/main/java/com/fasterxml/jackson/core/io/JsonStringEncoder.java

+32-6
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ public JsonStringEncoder() { }
4747
/**
4848
* Factory method for getting an instance; this is either recycled per-thread instance,
4949
* or a newly constructed one.
50+
*
51+
* @return Static stateless encoder instance
5052
*/
5153
public static JsonStringEncoder getInstance() {
5254
return instance;
@@ -59,8 +61,12 @@ public static JsonStringEncoder getInstance() {
5961
*/
6062

6163
/**
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}
6470
*/
6571
public char[] quoteAsString(String input)
6672
{
@@ -131,6 +137,10 @@ public char[] quoteAsString(String input)
131137
/**
132138
* Overloaded variant of {@link #quoteAsString(String)}.
133139
*
140+
* @param input Value {@link CharSequence} to process
141+
*
142+
* @return JSON-escaped String matching {@code input}
143+
*
134144
* @since 2.10
135145
*/
136146
public char[] quoteAsString(CharSequence input)
@@ -210,6 +220,9 @@ public char[] quoteAsString(CharSequence input)
210220
* and append results to a supplied {@link StringBuilder}.
211221
* Use this variant if you have e.g. a {@link StringBuilder} and want to avoid superfluous copying of it.
212222
*
223+
* @param input Value {@link CharSequence} to process
224+
* @param output {@link StringBuilder} to append escaped contents to
225+
*
213226
* @since 2.8
214227
*/
215228
public void quoteAsString(CharSequence input, StringBuilder output)
@@ -247,8 +260,13 @@ public void quoteAsString(CharSequence input, StringBuilder output)
247260
}
248261

249262
/**
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}
252270
*/
253271
@SuppressWarnings("resource")
254272
public byte[] quoteAsUTF8(String text)
@@ -349,8 +367,12 @@ public byte[] quoteAsUTF8(String text)
349367
}
350368

351369
/**
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)
354376
*/
355377
@SuppressWarnings("resource")
356378
public byte[] encodeAsUTF8(String text)
@@ -447,6 +469,10 @@ public byte[] encodeAsUTF8(String text)
447469
/**
448470
* Overloaded variant of {@link #encodeAsUTF8(String)}.
449471
*
472+
* @param text Value {@link CharSequence} to process
473+
*
474+
* @return UTF-8 encoded bytes of {@code text} (without any escaping)
475+
*
450476
* @since 2.11
451477
*/
452478
@SuppressWarnings("resource")

src/main/java/com/fasterxml/jackson/core/io/OutputDecorator.java

+6-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
* processing during write operations.
1010
*/
1111
@SuppressWarnings("serial")
12-
public abstract class OutputDecorator implements java.io.Serializable // since 2.1
12+
public abstract class OutputDecorator
13+
implements java.io.Serializable // since 2.1
1314
{
1415
/**
1516
* Method called by {@link com.fasterxml.jackson.core.JsonFactory} instance when
@@ -21,6 +22,8 @@ public abstract class OutputDecorator implements java.io.Serializable // since 2
2122
*
2223
* @return OutputStream to use; either passed in argument, or something that
2324
* calls it
25+
*
26+
* @throws IOException if construction of decorated {@link OutputStream} fails
2427
*/
2528
public abstract OutputStream decorate(IOContext ctxt, OutputStream out) throws IOException;
2629

@@ -33,6 +36,8 @@ public abstract class OutputDecorator implements java.io.Serializable // since 2
3336
* @param w Original output writer
3437
*
3538
* @return Writer to use; either passed in argument, or something that calls it
39+
*
40+
* @throws IOException if construction of decorated {@link Writer} fails
3641
*/
3742
public abstract Writer decorate(IOContext ctxt, Writer w) throws IOException;
3843
}

src/main/java/com/fasterxml/jackson/core/io/SegmentedStringWriter.java

+2
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ public Writer append(CharSequence csq, int start, int end) {
7878
* and return result String.
7979
* Note that the method is not idempotent -- if called second time,
8080
* will just return an empty String.
81+
*
82+
* @return String that contains all aggregated content
8183
*/
8284
public String getAndClear() {
8385
String result = _buffer.contentsAsString();

src/main/java/com/fasterxml/jackson/core/io/UTF8Writer.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,9 @@ public void write(String str, int off, int len) throws IOException
351351
*/
352352

353353
/**
354-
* Method called to calculate UTF codepoint, from a surrogate pair.
354+
* Method called to calculate Unicode code-point, from a surrogate pair.
355+
*
356+
* @param secondPart Second UTF-16 unit of surrogate (first part stored in {@code _surrogate})
355357
*/
356358
protected int convertSurrogate(int secondPart)
357359
throws IOException

0 commit comments

Comments
 (0)