@Override
  public int getSerializedLength() {
    if (bufWithoutChecksum != null) {
      // Include extra bytes for block metadata.
      return this.bufWithoutChecksum.limit() + BLOCK_METADATA_SPACE;
    }
    return 0;
  }
An additional sanity-check in case no compression or encryption is being used.
hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileBlock.java