ShortBuffer: hasRemaining() : LongBuffer « java.nio « Java by API






ShortBuffer: hasRemaining()

 
import java.nio.ByteBuffer;
import java.nio.ShortBuffer;

public class Main {
  public static void main(String[] args) {
    ByteBuffer bb = ByteBuffer.wrap(new byte[] { 0, 0, 0, 0, 0, 0, 0, 'a' });
    bb.rewind();
    ShortBuffer sb = ((ByteBuffer) bb.rewind()).asShortBuffer();
    System.out.println("Short Buffer");
    while (sb.hasRemaining())
      System.out.println(sb.position() + " -> " + sb.get());

  }
}

   
  








Related examples in the same category

1.LongBuffer: clear()
2.LongBuffer: get()
3.LongBuffer: get(long[] dst)
4.LongBuffer: position()
5.LongBuffer: put(long l)
6.LongBuffer: put(long[] src, int offset, int length)
7.LongBuffer: remaining()