Java examples for java.nio:ByteBuffer
Check for a non null and full ByteBuffer.
//package com.java2s; import java.nio.ByteBuffer; public class Main { /** Check for a non null and full buffer. * @param buf the buffer to check//from ww w. j a va 2 s . c o m * @return true if the buffer is not null and the limit equals the capacity. */ public static boolean isFull(ByteBuffer buf) { return buf != null && buf.limit() == buf.capacity(); } }