Use While loop to read a DoubleBuffer : DoubleBuffer « File « Java Tutorial






import java.nio.ByteBuffer;
import java.nio.DoubleBuffer;

public class MainClass {
  public static void main(String[] args) {
    ByteBuffer bb = ByteBuffer.wrap(new byte[] { 0, 0, 0, 0, 0, 0, 0, 'a' });
    bb.rewind();
    DoubleBuffer db = ((ByteBuffer) bb.rewind()).asDoubleBuffer();
    System.out.println("Double Buffer");
    while (db.hasRemaining())
      System.out.println(db.position() + " -> " + db.get());
  }
}
/*

 * 
 */
Double Buffer
0 -> 4.8E-322








11.44.DoubleBuffer
11.44.1.Create a DoubleBuffer
11.44.2.Convert ByteBuffer to DoubleBuffer
11.44.3.Use While loop to read a DoubleBuffer