HexDumper { public long dump(ByteBuffer in, Appendable out) throws HexDumperException { return dump(in, new AppendableHexDumpTarget(out)); } HexDumper(int bytesPerLine, DumpFragment... fragments); long dump(ByteBuffer in, Appendable out); long dump(ByteBuffer in, HexDumpTarget out);  }
@Test public void shouldDumpCorrectly() throws IOException { HexDumper dumper = new HexDumper(16, new LinePosFragment(6), new LiteralFragment("| "), new BytesAsHexFragment(8), new LiteralFragment(" |"), new BytesAsCharFragment()); ByteBuffer buffer = ByteBuffer.wrap("The quick brown fox jumps over the lazy dog".getBytes("UTF-8")); dumper.dump(buffer, System.out); }