VCDiffCodeTableWriterImpl implements com.davidehrmann.vcdiff.VCDiffCodeTableWriter<OutputStream> { public void copy(int offset, int size) { if (instructionMap == null) { throw new IllegalStateException("copy called without calling init()."); } AtomicInteger encoded_addr = new AtomicInteger(0); final byte mode = (byte) addraddressCachess_cache_.EncodeAddress(offset, dictionarySize + targetLength, encoded_addr); encodeInstruction(VCDiffCodeTableData.VCD_COPY, size, mode); if (addraddressCachess_cache_.WriteAddressAsVarintForMode(mode)) { addressesForCopy.expand(VarInt.calculateIntLength(encoded_addr.get())); VarInt.putInt(addressesForCopy.buf(), encoded_addr.get()); } else { addressesForCopy.put((byte)encoded_addr.get()); } targetLength += size; } VCDiffCodeTableWriterImpl(boolean interleaved);   VCDiffCodeTableWriterImpl(boolean interleaved, short nearCacheSize, short sameCacheSize, VCDiffCodeTableData codeTableData, short maxMode); void init(int dictionarySize); void add(byte[] data, int offset, int length); void addChecksum(int checksum); void copy(int offset, int size); void finishEncoding(OutputStream out); int getDeltaWindowSize(); void output(OutputStream out); void run(int size, byte b); void writeHeader(OutputStream out, EnumSet<VCDiffFormatExtension> formatExtensions); int targetLength();  }
@Test(expected = IllegalStateException.class) public void WriterCopyWithoutInit() { standard_writer.copy(6, 5); }