ensureHasEnoughBytes method

void ensureHasEnoughBytes(
  1. int minimumExpected
)

Implementation

void ensureHasEnoughBytes(int minimumExpected) {
  int remaining = trans_.getBytesRemainingInBuffer();
  if (remaining < 0) {
    return; // Some transport are not buffered
  }
  if (remaining < minimumExpected) {
    throw TProtocolError(TProtocolErrorType.INVALID_DATA,
        "Not enough bytes to read the entire message, the data appears to be truncated");
  }
}