@Test public void shouldFormatTwoFields() { final String format = "ab%sc%s"; final CharFormatter formatter = new CharFormatter(format) .with("D") .with("E"); assertFormatsTo("abDcE", formatter); }
public CharFormatter with(final String string) { final int length = string.length(); final char[] value = ensureLength(length); lengths[encodedSoFar] = length; string.getChars(0, length, value, 0); encodedSoFar++; return this; }
CharFormatter { public CharFormatter with(final String string) { final int length = string.length(); final char[] value = ensureLength(length); lengths[encodedSoFar] = length; string.getChars(0, length, value, 0); encodedSoFar++; return this; } }
CharFormatter { public CharFormatter with(final String string) { final int length = string.length(); final char[] value = ensureLength(length); lengths[encodedSoFar] = length; string.getChars(0, length, value, 0); encodedSoFar++; return this; } CharFormatter(final String formatString); }
CharFormatter { public CharFormatter with(final String string) { final int length = string.length(); final char[] value = ensureLength(length); lengths[encodedSoFar] = length; string.getChars(0, length, value, 0); encodedSoFar++; return this; } CharFormatter(final String formatString); CharFormatter with(final String string); CharFormatter with(final byte[] asciiBytes, final int length); CharFormatter with(final int number); CharFormatter with(final boolean value); CharFormatter with(final long number); CharFormatter clear(); void appendTo(final StringBuilder builder); int putIntAscii(final char[] buffer, final int index, final int value); int putLongAscii(final char[] buffer, final int index, final long value); }
CharFormatter { public CharFormatter with(final String string) { final int length = string.length(); final char[] value = ensureLength(length); lengths[encodedSoFar] = length; string.getChars(0, length, value, 0); encodedSoFar++; return this; } CharFormatter(final String formatString); CharFormatter with(final String string); CharFormatter with(final byte[] asciiBytes, final int length); CharFormatter with(final int number); CharFormatter with(final boolean value); CharFormatter with(final long number); CharFormatter clear(); void appendTo(final StringBuilder builder); int putIntAscii(final char[] buffer, final int index, final int value); int putLongAscii(final char[] buffer, final int index, final long value);  }