code: private void checkLength(boolean eof) {
          if (eof) {
              if (this.dataLength != this.expectedLength) {
                  throw new BceClientException("Data read (" + this.dataLength +
                          ") has a different length than the expected (" + this.expectedLength +
                          ")");
              }
          } else if (this.dataLength > this.expectedLength) {
              throw new BceClientException("More data read (" + this.dataLength + ") than expected (" +
                      this.expectedLength + ")");
          }
      }
docs: Checks the data length read so far against the expected total.
  
  @param eof true if end of stream has been encountered; false otherwise
  @throws com.baidubce.BceClientException if the data length read has exceeded the expected total, or if the total
  data length is not the same as the expected total.