Java examples for java.nio:ByteBuffer
ByteBuffer position is 0 and limit = capacity.
//package com.java2s; import java.nio.ByteBuffer; public class Main { /**//from w w w. jav a2s .c o m * position is 0 and limit = capacity. * * @param bb * @return */ public final static boolean isEmpty(final ByteBuffer bb) { return (bb.position() == 0 && bb.limit() == bb.capacity()) || bb.limit() == 0; } }