示例#1
0
 private static void throwBufferSizeException(StructBuffer<?, ?> buf, int size) {
   throw new IllegalArgumentException(
       "Number of remaining struct values in buffer is "
           + buf.remaining()
           + ", must be at least "
           + size);
 }
示例#2
0
 private static void throwBufferSizeGTException(StructBuffer<?, ?> buf, int size) {
   throw new IllegalArgumentException(
       "Number of remaining buffer elements is "
           + buf.remaining()
           + ", must be at most "
           + size
           + ".");
 }
示例#3
0
 public static void checkBufferGT(StructBuffer<?, ?> buf, int size) {
   if (size < buf.remaining()) throwBufferSizeGTException(buf, size);
 }
示例#4
0
 /**
  * Helper method to ensure a {@link StructBuffer} has enough capacity.
  *
  * @param buf the buffer to check
  * @param size the minimum buffer capacity
  * @throws IllegalArgumentException
  */
 public static void checkBuffer(StructBuffer<?, ?> buf, int size) {
   if (buf.remaining() < size) {
     throwBufferSizeException(buf, size);
   }
 }