Java DoubleBuffer.slice()

Syntax

DoubleBuffer.slice() has the following syntax.

public abstract DoubleBuffer slice()

Example

In the following code shows how to use DoubleBuffer.slice() method.


import java.nio.DoubleBuffer;
import java.util.Arrays;
/*w ww.  j  a  va2 s .c  om*/
public class Main {
  private static final int BSIZE = 1024;

  public static void main(String[] args) {
    DoubleBuffer bb = DoubleBuffer.allocate(BSIZE);

    bb.put(98765);
    
    DoubleBuffer bb1 = bb.slice();
    
    System.out.println(Arrays.toString(bb1.array()));

  }
}

The code above generates the following result.





















Home »
  Java Tutorial »
    java.nio »




Buffer
ByteBuffer
ByteOrder
CharBuffer
DoubleBuffer
FloatBuffer
IntBuffer
LongBuffer
MappedByteBuffer
ShortBuffer