ByteBuffer position is 0 and limit = capacity. - Java java.nio

Java examples for java.nio:ByteBuffer

Description

ByteBuffer position is 0 and limit = capacity.

Demo Code


//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;
    }
}

Related Tutorials