public void writeBytes(byte[] b, int offset, int length) {assert b.length >= offset + length;if (length == 0) {return;}if (upto == blockSize) {if (currentBlock != null) {addBlock(currentBlock);}currentBlock = new byte[blockSize];upto = 0;}final int offsetEnd = offset + length;while(true) {final int left = offsetEnd - offset;final int blockLeft = blockSize - upto;if (blockLeft < left) {System.arraycopy(b, offset, currentBlock, upto, blockLeft);addBlock(currentBlock);currentBlock = new byte[blockSize];upto = 0;offset += blockLeft;} else {System.arraycopy(b, offset, currentBlock, upto, left);upto += left;break;}}}

public override void WriteBytes(byte[] b, int offset, int length){Debug.Assert(b.Length >= offset + length);if (length == 0){return;}if (outerInstance.upto == outerInstance.blockSize){if (outerInstance.currentBlock != null){outerInstance.blocks.Add(outerInstance.currentBlock);outerInstance.blockEnd.Add(outerInstance.upto);}outerInstance.currentBlock = new byte[outerInstance.blockSize];outerInstance.upto = 0;}int offsetEnd = offset + length;while (true){int left = offsetEnd - offset;int blockLeft = outerInstance.blockSize - outerInstance.upto;if (blockLeft < left){System.Buffer.BlockCopy(b, offset, outerInstance.currentBlock, outerInstance.upto, blockLeft);outerInstance.blocks.Add(outerInstance.currentBlock);outerInstance.blockEnd.Add(outerInstance.blockSize);outerInstance.currentBlock = new byte[outerInstance.blockSize];outerInstance.upto = 0;offset += blockLeft;}else{System.Buffer.BlockCopy(b, offset, outerInstance.currentBlock, outerInstance.upto, left);outerInstance.upto += left;break;}}}
