dap4/d4core/src/main/java/dap4/core/util/DapDump.java
static public void
    dumpbytes(ByteBuffer buf0)
    {
        int stop = buf0.limit();
        int size = stop + 8;
        int savepos = buf0.position();
        assert savepos == 0;
        byte[] bytes = new byte[size];
        Arrays.fill(bytes, (byte) 0);
        buf0.get(bytes,0,stop);
        buf0.position(savepos);
        ByteBuffer buf = ByteBuffer.wrap(bytes).order(buf0.order());
        buf.position(0);
        buf.limit(size);
        int i = 0;
        try {
            for(i = 0; buf.position() < stop; i++) {
                savepos = buf.position();
                int iv = buf.getInt();
                buf.position(savepos);
                long lv = buf.getLong();
                buf.position(savepos);
                short sv = buf.getShort();
                buf.position(savepos);
                byte b = buf.get();
                int ub = ((int)b) & 0x000000FF;
                long uiv = ((long) iv) & 0xFFFFFFFFL;
                int usv = ((int) sv) & 0xFFFF;
                int ib = (int) b;
                char c = (char) ub;
                String s = Character.toString(c);
                if(c == '\r') s = "\\r";
                else if(c == '\n') s = "\\n";
                else if(c < ' ' || c >= 0x7f) s = "?";
                System.err.printf("[%03d] %02x %03d %4d '%s'", i, ub, ub, ib, s);
                System.err.printf("\t%12d 0x%08x", iv, uiv);
                System.err.printf("\t%5d\t0x%04x", sv, usv);
                System.err.println();
                System.err.flush();
            }

        } catch (Exception e) {
            System.err.println("failure:" + e);
        } finally {
            System.err.flush();
            //new Exception().printStackTrace(System.err);
	        System.err.flush();
        }
    }
static public void
    dumpbytes(ByteBuffer buf0)
    {
        int stop = buf0.limit();
        int size = stop + 8;
        int savepos = buf0.position();
        assert savepos == 0;
        byte[] bytes = new byte[size];
        Arrays.fill(bytes, (byte) 0);
        buf0.get(bytes,0,stop);
        buf0.position(savepos);
        ByteBuffer buf = ByteBuffer.wrap(bytes).order(buf0.order());
        buf.position(0);
        buf.limit(size);
        int i = 0;
        try {
            for(i = 0; buf.position() < stop; i++) {
                savepos = buf.position();
                int iv = buf.getInt();
                buf.position(savepos);
                long lv = buf.getLong();
                buf.position(savepos);
                short sv = buf.getShort();
                buf.position(savepos);
                byte b = buf.get();
                int ub = ((int)b) & 0x000000FF;
                long uiv = ((long) iv) & 0xFFFFFFFFL;
                int usv = ((int) sv) & 0xFFFF;
                int ib = (int) b;
                char c = (char) ub;
                String s = Character.toString(c);
                if(c == '\r') s = "\\r";
                else if(c == '\n') s = "\\n";
                else if(c < ' ' || c >= 0x7f) s = "?";
                System.err.printf("[%03d] %02x %03d %4d '%s'", i, ub, ub, ib, s);
                System.err.printf("\t%12d 0x%08x", iv, uiv);
                System.err.printf("\t%5d\t0x%04x", sv, usv);
                System.err.println();
                System.err.flush();
            }

        } catch (Exception e) {
            System.err.println("failure:" + e);
        } finally {
            System.err.flush();
            //new Exception().printStackTrace(System.err);
	        System.err.flush();
        }
    }
Dump the contents of a buffer from 0 to position

@param buf0 byte buffer to dump