public static void checkNotNullOrEmpty(ByteBuffer buffer, String exceptionMessage) {
    if (buffer == null || !buffer.hasRemaining()) {
      throw new IllegalArgumentException(exceptionMessage);
    }
  }
Check whether the given byte buffer is null or empty.  If so, throw IllegalArgumentException.

@param buffer The buffer to check.
@param exceptionMessage The IllegalArgumentException message to use if null or empty.
ambry-utils/src/main/java/com/github/ambry/utils/Utils.java