Java CharBuffer.wrap(CharSequence csq)

Syntax

CharBuffer.wrap(CharSequence csq) has the following syntax.

public static CharBuffer wrap(CharSequence csq)

Example

In the following code shows how to use CharBuffer.wrap(CharSequence csq) method.


import java.nio.CharBuffer;
//from ww  w .j ava 2 s.  com
public class Main {
  public static void main(String[] args) {
    CharBuffer cb1 = CharBuffer.wrap("java2s.com");
    System.out.println(cb1.toString());
   

  }
}

The code above generates the following result.





















Home »
  Java Tutorial »
    java.nio »




Buffer
ByteBuffer
ByteOrder
CharBuffer
DoubleBuffer
FloatBuffer
IntBuffer
LongBuffer
MappedByteBuffer
ShortBuffer