text: public final void setBufferSize(int newSize) {assert buffer == null || bufferSize == buffer.length: "buffer=" + buffer + " bufferSize=" + bufferSize + " buffer.length=" + (buffer != null ? buffer.length : 0);if (newSize != bufferSize) {checkBufferSize(newSize);bufferSize = newSize;if (buffer != null) {byte[] newBuffer = new byte[newSize];final int leftInBuffer = bufferLength-bufferPosition;final int numToCopy;if (leftInBuffer > newSize)numToCopy = newSize;elsenumToCopy = leftInBuffer;System.arraycopy(buffer, bufferPosition, newBuffer, 0, numToCopy);bufferStart += bufferPosition;bufferPosition = 0;bufferLength = numToCopy;newBuffer(newBuffer);}}}