Java LongBuffer.slice()

Syntax

LongBuffer.slice() has the following syntax.

public abstract LongBuffer slice()

Example

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


import java.nio.LongBuffer;
import java.util.Arrays;
// w  ww .jav  a  2s . com
public class Main {
  public static void main(String[] args) {
    LongBuffer longBuffer = LongBuffer.allocate(10);
    longBuffer.put(100);
    
    longBuffer.rewind();
    
    
    LongBuffer longBuffer2 = longBuffer.slice();
    
    System.out.println(longBuffer2.equals(longBuffer2));

  }
}

The code above generates the following result.





















Home »
  Java Tutorial »
    java.nio »




Buffer
ByteBuffer
ByteOrder
CharBuffer
DoubleBuffer
FloatBuffer
IntBuffer
LongBuffer
MappedByteBuffer
ShortBuffer