Java IO Tutorial - Java CharBuffer.isDirect()








Syntax

CharBuffer.isDirect() has the following syntax.

public abstract boolean isDirect()

Example

In the following code shows how to use CharBuffer.isDirect() method.

import java.nio.CharBuffer;
/*from  www  .j  a  v a 2s .c  om*/
public class Main {
  public static void main(String[] args) {
    CharBuffer cb1 = CharBuffer.allocate(50);
    cb1.append("java2s.com");
    cb1.rewind();

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

The code above generates the following result.