Java examples for java.nio:ByteBuffer
Check for an empty or null ByteBuffer.
//package com.java2s; import java.nio.ByteBuffer; public class Main { /** Check for an empty or null buffer. * @param buf the buffer to check// w w w . ja v a 2s .c o m * @return true if the buffer is null or empty. */ public static boolean isEmpty(ByteBuffer buf) { return buf == null || buf.remaining() == 0; } }