public void append(final BytesRef bytes) {int bytesLeft = bytes.length;int offset = bytes.offset;while (bytesLeft > 0) {int bufferLeft = BYTE_BLOCK_SIZE - byteUpto;if (bytesLeft < bufferLeft) {System.arraycopy(bytes.bytes, offset, buffer, byteUpto, bytesLeft);byteUpto += bytesLeft;break;} else {if (bufferLeft > 0) {System.arraycopy(bytes.bytes, offset, buffer, byteUpto, bufferLeft);}nextBuffer();bytesLeft -= bufferLeft;offset += bufferLeft;}}}

public void Append(BytesRef bytes){var length = bytes.Length;if (length == 0){return;}int offset = bytes.Offset;int overflow = (length + ByteUpto) - BYTE_BLOCK_SIZE;do{if (overflow <= 0){Array.Copy(bytes.Bytes, offset, buffer, ByteUpto, length);ByteUpto += length;break;}else{int bytesToCopy = length - overflow;if (bytesToCopy > 0){Array.Copy(bytes.Bytes, offset, buffer, ByteUpto, bytesToCopy);offset += bytesToCopy;length -= bytesToCopy;}NextBuffer();overflow = overflow - BYTE_BLOCK_SIZE;}} while (true);}
