Java ByteBuffer Dump dump(ByteBuffer buffer)

Here you can find the source of dump(ByteBuffer buffer)

Description

dump

License

Open Source License

Declaration

public static void dump(ByteBuffer buffer) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.nio.ByteBuffer;

public class Main {
    public static void dump(ByteBuffer buffer) {
        System.out.println();//from  w  ww.  j  av a 2 s.co m
        int mark = buffer.position();

        int ii = 0;
        while (buffer.hasRemaining()) {
            if ((ii & 15) == 0)
                System.out.printf("%04X: ", ii);

            System.out.printf("%02X ", buffer.get());

            if ((ii & 15) == 15)
                System.out.println();
            ii++;
        }

        buffer.position(mark);
        System.out.println();
    }
}

Related

  1. bbdump(ByteBuffer sbb)
  2. dump(ByteBuffer bb)
  3. dump(ByteBuffer buff, int size, boolean asBits)
  4. dump(ByteBuffer buffer)
  5. dump(ByteBuffer buffer, int pos, int limit)
  6. dump(ByteBuffer buffer, OutputStream stream)
  7. dumpAsHex(byte[] byteBuffer, int length)