JSONCodeTableWriter implements VCDiffCodeTableWriter<Appendable> { public void run(int size, byte b) { if (opcodeAdded) { output.append(','); } output.append('"'); StringBuilder escapedByte = new StringBuilder(8); JSONEscape(b, escapedByte); for (int i = 0; i < size; i++) { output.append(escapedByte); } output.append('"'); opcodeAdded = true; } JSONCodeTableWriter(); void init(int dictionarySize); void add(final byte[] data, final int offset, final int length); void addChecksum(int checksum); void copy(int offset, int size); void finishEncoding(Appendable out); void output(Appendable out); void run(int size, byte b); @SuppressWarnings("deprecation") void writeHeader(Appendable out, EnumSet<VCDiffFormatExtension> formatExtensions);  }
@Test public void Run() throws IOException { coder_.run(3, (byte) 'a'); coder_.output(writer); coder_.finishEncoding(writer); assertEquals("[\"aaa\"]", writer.toString()); }