Here you can find the source of printBuffer(CharBuffer charBuffer)
Parameter | Description |
---|---|
charBuffer | a parameter |
public static void printBuffer(CharBuffer charBuffer)
//package com.java2s; //License from project: Open Source License import java.nio.CharBuffer; public class Main { /**/*ww w. java2 s . co m*/ * * @param charBuffer */ public static void printBuffer(CharBuffer charBuffer) { charBuffer.mark(); // while (charBuffer.hasRemaining()){ // System.out.print("-"+charBuffer.get()); // } int remain = charBuffer.remaining(); char[] ch = new char[remain]; charBuffer.get(ch, 0, remain); System.out.print(new String(ch)); charBuffer.reset(); } }