checkContainerReadLength method

void checkContainerReadLength(
  1. int length
)

Implementation

void checkContainerReadLength(int length) {
  if (length < 0) {
    throw TProtocolError(
        TProtocolErrorType.NEGATIVE_SIZE, "Negative length $length");
  }
  if (containerLengthLimit_ > 0 && length > containerLengthLimit_) {
    throw TProtocolError(TProtocolErrorType.SIZE_LIMIT,
        "Length $length exceeds container length limit $containerLengthLimit_");
  }
}