Java CharBuffer printBuffer(CharBuffer charBuffer)

Here you can find the source of printBuffer(CharBuffer charBuffer)

Description

print Buffer

License

Open Source License

Parameter

Parameter Description
charBuffer a parameter

Declaration

public static void printBuffer(CharBuffer charBuffer) 

Method Source Code

//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();
    }
}

Related

  1. convertCharBufferToArray(java.nio.CharBuffer buf)
  2. eraseCharBuffer(CharBuffer buffer)
  3. extendBuffer(CharBuffer buffer, int size)
  4. getCharsFromBufferAndReset(CharBuffer buffer)
  5. nextEquals(final CharBuffer buffer, final char next)
  6. printCharBuffer(CharBuffer msg)
  7. put(char c, CharBuffer buffer)
  8. searchNewline(CharBuffer buffer, int from)
  9. startsWith(final CharBuffer charBuffer, final String token)