@Override
  public String toString() {
    StringBuilder sb = new StringBuilder().append("[").append("blockType=").append(blockType)
      .append(", fileOffset=").append(offset).append(", headerSize=").append(headerSize())
      .append(", onDiskSizeWithoutHeader=").append(onDiskSizeWithoutHeader)
      .append(", uncompressedSizeWithoutHeader=").append(uncompressedSizeWithoutHeader)
      .append(", prevBlockOffset=").append(prevBlockOffset).append(", isUseHBaseChecksum=")
      .append(fileContext.isUseHBaseChecksum());
    if (fileContext.isUseHBaseChecksum()) {
      sb.append(", checksumType=").append(ChecksumType.codeToType(this.bufWithoutChecksum.get(24)))
        .append(", bytesPerChecksum=").append(this.bufWithoutChecksum.getInt(24 + 1))
        .append(", onDiskDataSizeWithHeader=").append(onDiskDataSizeWithHeader);
    } else {
      sb.append(", onDiskDataSizeWithHeader=").append(onDiskDataSizeWithHeader).append("(")
        .append(onDiskSizeWithoutHeader).append("+")
        .append(HConstants.HFILEBLOCK_HEADER_SIZE_NO_CHECKSUM).append(")");
    }
    String dataBegin;
    if (bufWithoutChecksum.hasArray()) {
      dataBegin = Bytes.toStringBinary(bufWithoutChecksum.array(),
        bufWithoutChecksum.arrayOffset() + headerSize(),
        Math.min(32, bufWithoutChecksum.limit() - bufWithoutChecksum.arrayOffset() - headerSize()));
    } else {
      ByteBuff bufWithoutHeader = getBufferWithoutHeader();
      byte[] dataBeginBytes =
        new byte[Math.min(32, bufWithoutHeader.limit() - bufWithoutHeader.position())];
      bufWithoutHeader.get(dataBeginBytes);
      dataBegin = Bytes.toStringBinary(dataBeginBytes);
    }
    sb.append(", getOnDiskSizeWithHeader=").append(getOnDiskSizeWithHeader())
      .append(", totalChecksumBytes=").append(totalChecksumBytes()).append(", isUnpacked=")
      .append(isUnpacked()).append(", buf=[").append(bufWithoutChecksum).append("]")
      .append(", dataBeginsWith=").append(dataBegin).append(", fileContext=").append(fileContext)
      .append(", nextBlockOnDiskSize=").append(nextBlockOnDiskSize).append("]");
    return sb.toString();
  }
Checks if the block is internally consistent, i.e. the first
{@link HConstants#HFILEBLOCK_HEADER_SIZE} bytes of the buffer contain a valid header consistent
with the fields. Assumes a packed block structure. This function is primary for testing and
debugging, and is not thread-safe, because it alters the internal buffer pointer. Used by tests
only.
hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileBlock.java