Android CharBuffer Create newCharBuffer(int numChars)

Here you can find the source of newCharBuffer(int numChars)

Description

new Char Buffer

License

Apache License

Declaration

public static CharBuffer newCharBuffer(int numChars) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright 2011 See AUTHORS file.//  w  w  w  .  j  a v a  2 s .c  o  m
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 ******************************************************************************/

import java.nio.*;

public class Main {
    public static CharBuffer newCharBuffer(int numChars) {
        ByteBuffer buffer = ByteBuffer.allocateDirect(numChars * 2);
        buffer.order(ByteOrder.nativeOrder());
        return buffer.asCharBuffer();
    }
}

Related

  1. newCharBuffer(int numChars)
  2. newCharBuffer(int numChars)