@@ -95,33 +95,6 @@ public interface DataBuffer {
9595 */
9696 int capacity ();
9797
98- /**
99- * Set the number of bytes that this buffer can contain.
100- *
101- * <p>If the new capacity is lower than the current capacity, the contents of this buffer will be
102- * truncated. If the new capacity is higher than the current capacity, it will be expanded.
103- *
104- * @param capacity the new capacity
105- * @return this buffer
106- * @deprecated as of 6.0, in favor of {@link #ensureWritable(int)}, which has different semantics
107- */
108- @ Deprecated (since = "6.0" )
109- DataBuffer capacity (int capacity );
110-
111- /**
112- * Ensure that the current buffer has enough {@link #writableByteCount()} to write the amount of
113- * data given as an argument. If not, the missing capacity will be added to the buffer.
114- *
115- * @param capacity the writable capacity to check for
116- * @return this buffer
117- * @since 5.1.4
118- * @deprecated since 6.0, in favor of {@link #ensureWritable(int)}
119- */
120- @ Deprecated (since = "6.0" )
121- default DataBuffer ensureCapacity (int capacity ) {
122- return ensureWritable (capacity );
123- }
124-
12598 /**
12699 * Ensure that the current buffer has enough {@link #writableByteCount()} to write the amount of
127100 * data given as an argument. If not, the missing capacity will be added to the buffer.
@@ -300,51 +273,11 @@ default DataBuffer write(CharSequence charSequence, Charset charset) {
300273 return this ;
301274 }
302275
303- /**
304- * Create a new {@code DataBuffer} whose contents is a shared subsequence of this data buffer's
305- * content. Data between this data buffer and the returned buffer is shared; though changes in the
306- * returned buffer's position will not be reflected in the reading nor writing position of this
307- * data buffer.
308- *
309- * <p><strong>Note</strong> that this method will <strong>not</strong> call {@link
310- * DataBufferUtils#retain(DataBuffer)} on the resulting slice: the reference count will not be
311- * increased.
312- *
313- * @param index the index at which to start the slice
314- * @param length the length of the slice
315- * @return the specified slice of this data buffer
316- * @deprecated as of 6.0, in favor of {@link #split(int)}, which has different semantics
317- */
318- @ Deprecated (since = "6.0" )
319- DataBuffer slice (int index , int length );
320-
321- /**
322- * Create a new {@code DataBuffer} whose contents is a shared, retained subsequence of this data
323- * buffer's content. Data between this data buffer and the returned buffer is shared; though
324- * changes in the returned buffer's position will not be reflected in the reading nor writing
325- * position of this data buffer.
326- *
327- * <p><strong>Note</strong> that unlike {@link #slice(int, int)}, this method
328- * <strong>will</strong> call {@link DataBufferUtils#retain(DataBuffer)} (or equivalent) on the
329- * resulting slice.
330- *
331- * @param index the index at which to start the slice
332- * @param length the length of the slice
333- * @return the specified, retained slice of this data buffer
334- * @since 5.2
335- * @deprecated as of 6.0, in favor of {@link #split(int)}, which has different semantics
336- */
337- @ Deprecated (since = "6.0" )
338- default DataBuffer retainedSlice (int index , int length ) {
339- return DataBufferUtils .retain (slice (index , length ));
340- }
341-
342276 /**
343277 * Splits this data buffer into two at the given index.
344278 *
345279 * <p>Data that precedes the {@code index} will be returned in a new buffer, while this buffer
346- * will contain data that follows after {@code index}. Memory between the two buffers is shared,
347- * but independent and cannot overlap (unlike {@link #slice(int, int) slice}).
280+ * will contain data that follows after {@code index}. Memory between the two buffers is shared.
348281 *
349282 * <p>The {@linkplain #readPosition() read} and {@linkplain #writePosition() write} position of
350283 * the returned buffer are truncated to fit within the buffers {@linkplain #capacity() capacity}
@@ -357,64 +290,6 @@ default DataBuffer retainedSlice(int index, int length) {
357290 */
358291 DataBuffer split (int index );
359292
360- /**
361- * Expose this buffer's bytes as a {@link ByteBuffer}. Data between this {@code DataBuffer} and
362- * the returned {@code ByteBuffer} is shared; though changes in the returned buffer's {@linkplain
363- * ByteBuffer#position() position} will not be reflected in the reading nor writing position of
364- * this data buffer.
365- *
366- * @return this data buffer as a byte buffer
367- * @deprecated as of 6.0, in favor of {@link #toByteBuffer(ByteBuffer)}, {@link
368- * #readableByteBuffers()}, or {@link #writableByteBuffers()}.
369- */
370- @ Deprecated (since = "6.0" )
371- ByteBuffer asByteBuffer ();
372-
373- /**
374- * Expose a subsequence of this buffer's bytes as a {@link ByteBuffer}. Data between this {@code
375- * DataBuffer} and the returned {@code ByteBuffer} is shared; though changes in the returned
376- * buffer's {@linkplain ByteBuffer#position() position} will not be reflected in the reading nor
377- * writing position of this data buffer.
378- *
379- * @param index the index at which to start the byte buffer
380- * @param length the length of the returned byte buffer
381- * @return this data buffer as a byte buffer
382- * @since 5.0.1
383- * @deprecated as of 6.0, in favor of {@link #toByteBuffer(int, ByteBuffer, int, int)}, {@link
384- * #readableByteBuffers()}, or {@link #writableByteBuffers()}.
385- */
386- @ Deprecated (since = "6.0" )
387- ByteBuffer asByteBuffer (int index , int length );
388-
389- /**
390- * Returns a {@link ByteBuffer} representation of this data buffer. Data between this {@code
391- * DataBuffer} and the returned {@code ByteBuffer} is <strong>not</strong> shared.
392- *
393- * @return this data buffer as a byte buffer
394- * @since 6.0
395- * @see #readableByteBuffers()
396- * @see #writableByteBuffers()
397- * @deprecated as of 6.0.5, in favor of {@link #toByteBuffer(ByteBuffer)}
398- */
399- @ Deprecated (since = "6.0.5" )
400- default ByteBuffer toByteBuffer () {
401- return toByteBuffer (readPosition (), readableByteCount ());
402- }
403-
404- /**
405- * Returns a {@link ByteBuffer} representation of a subsequence of this buffer's bytes. Data
406- * between this {@code DataBuffer} and the returned {@code ByteBuffer} is <strong>not</strong>
407- * shared.
408- *
409- * @return this data buffer as a byte buffer
410- * @since 6.0
411- * @see #readableByteBuffers()
412- * @see #writableByteBuffers()
413- * @deprecated as of 6.0.5, in favor of {@link #toByteBuffer(int, ByteBuffer, int, int)}
414- */
415- @ Deprecated (since = "6.0.5" )
416- ByteBuffer toByteBuffer (int index , int length );
417-
418293 /**
419294 * Copies this entire data buffer into the given destination {@code ByteBuffer}, beginning at the
420295 * current {@linkplain #readPosition() reading position}, and the current {@linkplain
@@ -442,7 +317,6 @@ default void toByteBuffer(ByteBuffer dest) {
442317
443318 /**
444319 * Returns a closeable iterator over each {@link ByteBuffer} in this data buffer that can be read.
445- * Calling this method is more efficient than {@link #toByteBuffer()}, as no data is copied.
446320 * However, the byte buffers provided can only be used during the iteration.
447321 *
448322 * <p><b>Note</b> that the returned iterator must be used in a try-with-resources clause or
0 commit comments