Java CharBuffer.put(String src)

Syntax

CharBuffer.put(String src) has the following syntax.

public final CharBuffer put(String src)

Example

In the following code shows how to use CharBuffer.put(String src) method.


//  w  w w  . jav  a  2  s .  c  o  m
import java.nio.CharBuffer;

public class Main {
  public static void main(String[] args) {
    CharBuffer cb1 = CharBuffer.allocate(5);
    cb1.put("java2s.com");
    cb1.rewind();

    System.out.println(cb1.toString());
  }
}




















Home »
  Java Tutorial »
    java.nio »




Buffer
ByteBuffer
ByteOrder
CharBuffer
DoubleBuffer
FloatBuffer
IntBuffer
LongBuffer
MappedByteBuffer
ShortBuffer