Here you can find the source of dump(ByteBuffer buffer)
public static void dump(ByteBuffer buffer)
//package com.java2s; //License from project: Open Source License import java.nio.ByteBuffer; public class Main { public static void dump(ByteBuffer buffer) { ByteBuffer dup = buffer.duplicate(); byte[] bs = new byte[dup.position()]; dup.flip();//from w w w . j av a 2s .c om dup.get(bs); System.out.println(new String(bs)); } }