Java ByteBuffer Print printBuffer(ByteBuffer buffer)

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

Description

Prints the given buffer in hex format from the 0 position to the limit.

License

Open Source License

Parameter

Parameter Description
buffer the buffer to print

Declaration

public static void printBuffer(ByteBuffer buffer) 

Method Source Code


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

import java.nio.ByteBuffer;

public class Main {
    /**/*ww w  .j  a  v  a  2  s  .  c  om*/
     * Prints the given buffer in hex format from the 0 position to the limit.
     *
     * @param buffer the buffer to print
     */
    public static void printBuffer(ByteBuffer buffer) {
        for (int i = 0; i < buffer.limit(); i++) {
            System.out.format("%x ", buffer.get(i));
        }
    }
}

Related

  1. print(ByteBuffer bb)
  2. print(ByteBuffer byteBuffer)
  3. printBuffer(ByteBuffer buffer)
  4. printBuffer(String msg, ByteBuffer buffer)
  5. printByteBuffer(ByteBuffer buf)
  6. printData(ByteBuffer buf, int offset, int len)
  7. printData(ByteBuffer buffer, int len)