@Test void testLong() { String source = "abcXX"; byte[] bytes = source.getBytes(StandardCharsets.UTF_8); bytes[3] = (byte) 0xc0; bytes[4] = (byte) 0x00; Utf8StringBuilder buffer = new Utf8StringBuilder(); try { for (byte aByte : bytes) { buffer.append(aByte); } fail("Should have resulted in an Utf8Appendable.NotUtf8Exception"); } catch (Utf8Appendable.NotUtf8Exception e) { } assertEquals("abc\ufffd", buffer.toString()); }
@Override public String toString() { checkState(); return buffer.toString(); }
Utf8StringBuilder extends Utf8Appendable { @Override public String toString() { checkState(); return buffer.toString(); } }
Utf8StringBuilder extends Utf8Appendable { @Override public String toString() { checkState(); return buffer.toString(); } Utf8StringBuilder();  Utf8StringBuilder(int capacity); }
Utf8StringBuilder extends Utf8Appendable { @Override public String toString() { checkState(); return buffer.toString(); } Utf8StringBuilder();  Utf8StringBuilder(int capacity); @Override int length(); @Override void reset(); StringBuilder getStringBuilder(); @Override String toString(); }
Utf8StringBuilder extends Utf8Appendable { @Override public String toString() { checkState(); return buffer.toString(); } Utf8StringBuilder();  Utf8StringBuilder(int capacity); @Override int length(); @Override void reset(); StringBuilder getStringBuilder(); @Override String toString();  }