Java CharBuffer charBufferToChars(CharBuffer buffer)

Here you can find the source of charBufferToChars(CharBuffer buffer)

Description

char Buffer To Chars

License

LGPL

Parameter

Parameter Description
buffer a parameter

Declaration

public static char[] charBufferToChars(CharBuffer buffer) 

Method Source Code

//package com.java2s;
//License from project: LGPL 

import java.nio.CharBuffer;

import java.util.Arrays;

public class Main {
    /**/*from  w ww  .j a v  a2 s .c om*/
     * @param buffer
     * @return
     */
    public static char[] charBufferToChars(CharBuffer buffer) {
        final char[] array = buffer.array();
        final int arrayOffset = buffer.arrayOffset();
        return Arrays.copyOfRange(array, arrayOffset + buffer.position(), arrayOffset + buffer.limit());
    }
}

Related

  1. asChars(CharBuffer buffer)
  2. capacityRemaining(CharBuffer buffer)
  3. consume(CharBuffer buf, boolean trim)
  4. convertCharBufferToArray(java.nio.CharBuffer buf)
  5. eraseCharBuffer(CharBuffer buffer)
  6. extendBuffer(CharBuffer buffer, int size)