public Reader freeze(boolean trim) {if (frozen) {throw new IllegalStateException("already frozen");}if (didSkipBytes) {throw new IllegalStateException("cannot freeze when copy(BytesRef, BytesRef) was used");}if (trim && upto < blockSize) {final byte[] newBlock = new byte[upto];System.arraycopy(currentBlock, 0, newBlock, 0, upto);currentBlock = newBlock;}if (currentBlock == null) {currentBlock = EMPTY_BYTES;}addBlock(currentBlock);frozen = true;currentBlock = null;return new PagedBytes.Reader(this);}

public Reader Freeze(bool trim){if (frozen){throw new InvalidOperationException("already frozen");}if (didSkipBytes){throw new InvalidOperationException("cannot freeze when copy(BytesRef, BytesRef) was used");}if (trim && upto < blockSize){var newBlock = new byte[upto];Array.Copy(currentBlock, 0, newBlock, 0, upto);currentBlock = newBlock;}if (currentBlock == null){currentBlock = EMPTY_BYTES;}blocks.Add(currentBlock);blockEnd.Add(upto);frozen = true;currentBlock = null;return new PagedBytes.Reader(this);}
