2323import java .nio .InvalidMarkException ;
2424import java .util .ArrayDeque ;
2525import java .util .Deque ;
26- import java .util .Queue ;
2726import javax .annotation .Nullable ;
2827
2928/**
@@ -39,7 +38,6 @@ public class CompositeReadableBuffer extends AbstractReadableBuffer {
3938 private final Deque <ReadableBuffer > readableBuffers ;
4039 private Deque <ReadableBuffer > rewindableBuffers ;
4140 private int readableBytes ;
42- private final Queue <ReadableBuffer > buffers = new ArrayDeque <ReadableBuffer >(2 );
4341 private boolean marked ;
4442
4543 public CompositeReadableBuffer (int initialCapacity ) {
@@ -161,31 +159,6 @@ public void readBytes(OutputStream dest, int length) throws IOException {
161159 execute (STREAM_OP , length , dest , 0 );
162160 }
163161
164- /**
165- * Reads {@code length} bytes from this buffer and writes them to the destination buffer.
166- * Increments the read position by {@code length}. If the required bytes are not readable, throws
167- * {@link IndexOutOfBoundsException}.
168- *
169- * @param dest the destination buffer to receive the bytes.
170- * @param length the number of bytes to be copied.
171- * @throws IndexOutOfBoundsException if required bytes are not readable
172- */
173- public void readBytes (CompositeReadableBuffer dest , int length ) {
174- checkReadable (length );
175- readableBytes -= length ;
176-
177- while (length > 0 ) {
178- ReadableBuffer buffer = buffers .peek ();
179- if (buffer .readableBytes () > length ) {
180- dest .addBuffer (buffer .readBytes (length ));
181- length = 0 ;
182- } else {
183- dest .addBuffer (buffers .poll ());
184- length -= buffer .readableBytes ();
185- }
186- }
187- }
188-
189162 @ Override
190163 public ReadableBuffer readBytes (int length ) {
191164 if (length <= 0 ) {
0 commit comments