static ByteBuffer copyNoConsume(ByteBuffer[] buffers, ByteBuffer destination, int maxAmount) {
	checkArgument(destination.remaining() >= maxAmount, "Destination buffer too small");
	int needed = maxAmount;
        for (ByteBuffer buffer : buffers) {
	    int remaining = buffer.remaining();
            if (remaining > 0) {
                // If this buffer can fit completely then copy it all, otherwise temporarily
                // adjust its limit to fill so as to the output buffer completely
                int oldPosition = buffer.position();
                if (remaining <= needed) {
                    destination.put(buffer);
                    needed -= remaining;
                } else {
                    int oldLimit = buffer.limit();
                    buffer.limit(buffer.position() + needed);
                    destination.put(buffer);
                    buffer.limit(oldLimit);
                    needed = 0;
                }
                // Restore the buffer's position, the data won't get marked as consumed until
                // outputBuffer has been successfully consumed.
                buffer.position(oldPosition);
                if (needed == 0) {
                    break;
                }
            }
        }
        destination.flip();
        return destination;
    }
Copies up to {@code maxAmount} bytes from a buffer array to {@code destination}.
The copied data is <b>not</b> marked as consumed from the source buffers, on the
assumption the copy will be passed to some method which will consume between 0 and
{@code maxAmount} bytes which can then be reflected in the source array using the
{@code consume()} method.
common/src/main/java/org/conscrypt/BufferUtils.java