3636 * <p>{@code DataBuffer}s has a separate {@linkplain #readPosition() read} and
3737 * {@linkplain #writePosition() write} position, as opposed to {@code ByteBuffer}'s
3838 * single {@linkplain ByteBuffer#position() position}. As such, the {@code DataBuffer}
39- * does not require a {@linkplain ByteBuffer#flip() flip} to read after writing. In general,
40- * the following invariant holds for the read and write positions, and the capacity:
39+ * does not require a {@linkplain ByteBuffer#flip() flip} to read after writing.
40+ * In general, the following invariant holds for the read and write positions,
41+ * and the capacity:
4142 *
4243 * <blockquote>
4344 * {@code 0} {@code <=}
4647 * <i>capacity</i>
4748 * </blockquote>
4849 *
49- * <p>The {@linkplain #capacity() capacity} of a {@code DataBuffer} is expanded on demand,
50- * similar to {@code StringBuilder}.
50+ * <p>The {@linkplain #capacity() capacity} of a {@code DataBuffer} is expanded on
51+ * demand, similar to {@code StringBuilder}.
5152 *
52- * <p>The main purpose of the {@code DataBuffer} abstraction is to provide a convenient wrapper
53- * around {@link ByteBuffer} which is similar to Netty's {@link io.netty.buffer.ByteBuf} but
54- * can also be used on non-Netty platforms (i.e. Servlet containers).
53+ * <p>The main purpose of the {@code DataBuffer} abstraction is to provide a
54+ * convenient wrapper around {@link ByteBuffer} which is similar to Netty's
55+ * {@link io.netty.buffer.ByteBuf} but can also be used on non-Netty platforms
56+ * (i.e. Servlet containers).
5557 *
5658 * @author Arjen Poutsma
5759 * @author Brian Clozel
@@ -113,8 +115,8 @@ public interface DataBuffer {
113115 * the current capacity, it will be expanded.
114116 * @param capacity the new capacity
115117 * @return this buffer
116- * @deprecated as of 6.0, in favor of {@link #ensureWritable(int)}, which
117- * has different semantics
118+ * @deprecated as of 6.0, in favor of {@link #ensureWritable(int)}
119+ * which has different semantics
118120 */
119121 @ Deprecated (since = "6.0" )
120122 DataBuffer capacity (int capacity );
@@ -240,16 +242,16 @@ default int forEachByte(int index, int length, ByteProcessor processor) {
240242 DataBuffer write (byte b );
241243
242244 /**
243- * Write the given source into this buffer, starting at the current writing position
244- * of this buffer.
245+ * Write the given source into this buffer, starting at the current writing
246+ * position of this buffer.
245247 * @param source the bytes to be written into this buffer
246248 * @return this buffer
247249 */
248250 DataBuffer write (byte [] source );
249251
250252 /**
251- * Write at most {@code length} bytes of the given source into this buffer, starting
252- * at the current writing position of this buffer.
253+ * Write at most {@code length} bytes of the given source into this buffer,
254+ * starting at the current writing position of this buffer.
253255 * @param source the bytes to be written into this buffer
254256 * @param offset the index within {@code source} to start writing from
255257 * @param length the maximum number of bytes to be written from {@code source}
@@ -258,17 +260,17 @@ default int forEachByte(int index, int length, ByteProcessor processor) {
258260 DataBuffer write (byte [] source , int offset , int length );
259261
260262 /**
261- * Write one or more {@code DataBuffer}s to this buffer, starting at the current
262- * writing position. It is the responsibility of the caller to
263+ * Write one or more {@code DataBuffer}s to this buffer, starting at the
264+ * current writing position. It is the responsibility of the caller to
263265 * {@linkplain DataBufferUtils#release(DataBuffer) release} the given data buffers.
264266 * @param buffers the byte buffers to write into this buffer
265267 * @return this buffer
266268 */
267269 DataBuffer write (DataBuffer ... buffers );
268270
269271 /**
270- * Write one or more {@link ByteBuffer} to this buffer, starting at the current
271- * writing position.
272+ * Write one or more {@link ByteBuffer} to this buffer, starting at the
273+ * current writing position.
272274 * @param buffers the byte buffers to write into this buffer
273275 * @return this buffer
274276 */
@@ -321,36 +323,37 @@ else if (cr.isOverflow()) {
321323 }
322324
323325 /**
324- * Create a new {@code DataBuffer} whose contents is a shared subsequence of this
325- * data buffer's content. Data between this data buffer and the returned buffer is
326- * shared; though changes in the returned buffer's position will not be reflected
327- * in the reading nor writing position of this data buffer.
326+ * Create a new {@code DataBuffer} whose contents is a shared subsequence
327+ * of this data buffer's content. Data between this data buffer and the
328+ * returned buffer is shared; though changes in the returned buffer's
329+ * position will not be reflected in the reading nor writing position
330+ * of this data buffer.
328331 * <p><strong>Note</strong> that this method will <strong>not</strong> call
329- * {@link DataBufferUtils#retain(DataBuffer)} on the resulting slice: the reference
330- * count will not be increased.
332+ * {@link DataBufferUtils#retain(DataBuffer)} on the resulting slice:
333+ * the reference count will not be increased.
331334 * @param index the index at which to start the slice
332335 * @param length the length of the slice
333336 * @return the specified slice of this data buffer
334- * @deprecated as of 6.0, in favor of {@link #split(int)}, which
335- * has different semantics
337+ * @deprecated as of 6.0, in favor of {@link #split(int)}
338+ * which has different semantics
336339 */
337340 @ Deprecated (since = "6.0" )
338341 DataBuffer slice (int index , int length );
339342
340343 /**
341- * Create a new {@code DataBuffer} whose contents is a shared, retained subsequence of this
342- * data buffer's content. Data between this data buffer and the returned buffer is
343- * shared; though changes in the returned buffer's position will not be reflected
344- * in the reading nor writing position of this data buffer.
344+ * Create a new {@code DataBuffer} whose contents is a shared, retained subsequence
345+ * of this data buffer's content. Data between this data buffer and the returned
346+ * buffer is shared; though changes in the returned buffer's position will not be
347+ * reflected in the reading nor writing position of this data buffer.
345348 * <p><strong>Note</strong> that unlike {@link #slice(int, int)}, this method
346- * <strong>will</strong> call {@link DataBufferUtils#retain(DataBuffer)} (or equivalent) on the
347- * resulting slice.
349+ * <strong>will</strong> call {@link DataBufferUtils#retain(DataBuffer)}
350+ * (or equivalent) on the resulting slice.
348351 * @param index the index at which to start the slice
349352 * @param length the length of the slice
350353 * @return the specified, retained slice of this data buffer
351354 * @since 5.2
352- * @deprecated as of 6.0, in favor of {@link #split(int)}, which
353- * has different semantics
355+ * @deprecated as of 6.0, in favor of {@link #split(int)}
356+ * which has different semantics
354357 */
355358 @ Deprecated (since = "6.0" )
356359 default DataBuffer retainedSlice (int index , int length ) {
@@ -359,12 +362,10 @@ default DataBuffer retainedSlice(int index, int length) {
359362
360363 /**
361364 * Splits this data buffer into two at the given index.
362- *
363365 * <p>Data that precedes the {@code index} will be returned in a new buffer,
364366 * while this buffer will contain data that follows after {@code index}.
365367 * Memory between the two buffers is shared, but independent and cannot
366368 * overlap (unlike {@link #slice(int, int) slice}).
367- *
368369 * <p>The {@linkplain #readPosition() read} and
369370 * {@linkplain #writePosition() write} position of the returned buffer are
370371 * truncated to fit within the buffers {@linkplain #capacity() capacity} if
@@ -384,22 +385,22 @@ default DataBuffer retainedSlice(int index, int length) {
384385 * will not be reflected in the reading nor writing position of this data buffer.
385386 * @return this data buffer as a byte buffer
386387 * @deprecated as of 6.0, in favor of {@link #toByteBuffer(ByteBuffer)},
387- * {@link #readableByteBuffers()}, or {@link #writableByteBuffers()}.
388+ * {@link #readableByteBuffers()} or {@link #writableByteBuffers()}
388389 */
389390 @ Deprecated (since = "6.0" )
390391 ByteBuffer asByteBuffer ();
391392
392393 /**
393- * Expose a subsequence of this buffer's bytes as a {@link ByteBuffer}. Data between
394- * this {@code DataBuffer} and the returned {@code ByteBuffer} is shared; though
395- * changes in the returned buffer's {@linkplain ByteBuffer#position() position}
394+ * Expose a subsequence of this buffer's bytes as a {@link ByteBuffer}. Data
395+ * between this {@code DataBuffer} and the returned {@code ByteBuffer} is shared;
396+ * though changes in the returned buffer's {@linkplain ByteBuffer#position() position}
396397 * will not be reflected in the reading nor writing position of this data buffer.
397398 * @param index the index at which to start the byte buffer
398399 * @param length the length of the returned byte buffer
399400 * @return this data buffer as a byte buffer
400401 * @since 5.0.1
401402 * @deprecated as of 6.0, in favor of {@link #toByteBuffer(int, ByteBuffer, int, int)},
402- * {@link #readableByteBuffers()}, or {@link #writableByteBuffers()}.
403+ * {@link #readableByteBuffers()} or {@link #writableByteBuffers()}
403404 */
404405 @ Deprecated (since = "6.0" )
405406 ByteBuffer asByteBuffer (int index , int length );
@@ -553,6 +554,7 @@ interface ByteBufferIterator extends Iterator<ByteBuffer>, Closeable {
553554 void close ();
554555 }
555556
557+
556558 /**
557559 * Process a range of bytes one by one.
558560 * @since 6.2.12
@@ -565,10 +567,9 @@ interface ByteProcessor {
565567 * should continue further.
566568 * @param b a byte from the {@link DataBuffer}
567569 * @return {@code true} if processing should continue,
568- * or {@code false} if processing should stop at this element.
570+ * or {@code false} if processing should stop at this element
569571 */
570572 boolean process (byte b );
571-
572573 }
573574
574575}
0 commit comments