Wraps a character sequence into a buffer.

In this tutorial you will see how to wraps a character sequence into a buffer.

 
 

Share on Google+Share on Google+

Wraps a character sequence into a buffer.

Ads

In this tutorial you will see how to wraps a character sequence into a buffer.

Wraps a character sequence into a buffer.

In this tutorial you will see how to wraps a character sequence into a buffer.
Here in this example a string variable is having a sequence of character which is further wrapped into a buffer. 

Code:

import java.nio.CharBuffer;

public class CharBufferDemo1 {
  public static void main(String[] args) {
    String str = "abcdefghijklmnop";
    CharBuffer charbuffer1 = CharBuffer.wrap(str);
    charbuffer1.rewind();
    System.out.println(charbuffer1.length());
  }
}

Output:

  16

Download this code

Advertisements

Posted on: July 26, 2010 If you enjoyed this post then why not add us on Google+? Add us to your Circles