Skip to content

Commit bd0abd5

Browse files
authored
Javadoc for the feed methods (#7)
1 parent 8e4c42c commit bd0abd5

File tree

1 file changed

+25
-4
lines changed

1 file changed

+25
-4
lines changed

src/main/java/com/couchbase/jsonskiff/JsonStreamParser.java

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,12 @@ private JsonStreamParser(PathTree pathTree) {
8383
}
8484

8585
/**
86+
* Parses the contents of the stream, using the default buffer size
87+
* for copying data from the stream.
88+
* <p>
89+
* Searches for values matching the configured JSON pointers
90+
* and invokes callbacks for any matches.
91+
*
8692
* @throws UncheckedIOException if malformed JSON is detected in this chunk of input
8793
* @throws RuntimeException if a value consumer throws an exception
8894
*/
@@ -91,6 +97,12 @@ public void feed(InputStream is) {
9197
}
9298

9399
/**
100+
* Parses the contents of the stream, using a buffer of the specified size (in bytes)
101+
* for copying data from the stream.
102+
* <p>
103+
* Searches for values matching the configured JSON pointers
104+
* and invokes callbacks for any matches.
105+
*
94106
* @throws UncheckedIOException if malformed JSON is detected in this chunk of input
95107
* @throws RuntimeException if a value consumer throws an exception
96108
*/
@@ -109,10 +121,10 @@ public void feed(InputStream is, int bufferSizeInBytes) {
109121
}
110122

111123
/**
112-
* Consumes all readable bytes from the given buffer. Searches for values matching
113-
* the configured JSON pointers and invokes callbacks for any matches.
124+
* Parses the specified range of the given byte array.
114125
* <p>
115-
* Call this method repeatedly as more input becomes available.
126+
* Searches for values matching the configured JSON pointers
127+
* and invokes callbacks for any matches.
116128
*
117129
* @throws UncheckedIOException if malformed JSON is detected in this chunk of input
118130
* @throws RuntimeException if a value consumer throws an exception
@@ -128,6 +140,15 @@ public void feed(byte[] array, int offset, int len) {
128140
}
129141
}
130142

143+
/**
144+
* Parses the contents of the given buffer.
145+
* <p>
146+
* Searches for values matching the configured JSON pointers
147+
* and invokes callbacks for any matches.
148+
*
149+
* @throws UncheckedIOException if malformed JSON is detected in this chunk of input
150+
* @throws RuntimeException if a value consumer throws an exception
151+
*/
131152
public void feed(ByteBuffer input) {
132153
scratchBuffer.clear().writeBytes(input);
133154
feed(scratchBuffer.array(), 0, scratchBuffer.readableBytes());
@@ -138,7 +159,7 @@ public void feed(ByteBuffer input) {
138159
* After calling this method no more data can be fed and parser assumes
139160
* no more data will be available.
140161
*
141-
* @throws UncheckedIOException if malformed JSON is detected in this chunk of input.
162+
* @throws UncheckedIOException if malformed JSON is detected in the final chunk of input.
142163
* @throws RuntimeException if a value consumer throws an exception
143164
*/
144165
public void endOfInput() {

0 commit comments

Comments
 (0)