Java ByteBuffer.asLongBuffer()

Syntax

ByteBuffer.asLongBuffer() has the following syntax.

public abstract LongBuffer asLongBuffer()

Example

In the following code shows how to use ByteBuffer.asLongBuffer() method.


import java.nio.ByteBuffer;
//  w  w w.j  a va  2  s.  c o  m
public class Main {
  private static final int BSIZE = 1024;

  public static void main(String[] args) {
    ByteBuffer bb = ByteBuffer.allocate(BSIZE);
    bb.asLongBuffer().put(99472342341142L);
    System.out.println(bb.getLong());

  }
}

The code above generates the following result.





















Home »
  Java Tutorial »
    java.nio »




Buffer
ByteBuffer
ByteOrder
CharBuffer
DoubleBuffer
FloatBuffer
IntBuffer
LongBuffer
MappedByteBuffer
ShortBuffer