public static HFileIndexBlockEncoder createFromFileInfo(HFileInfo fileInfo) throws IOException {
    IndexBlockEncoding encoding = IndexBlockEncoding.NONE;
    byte[] dataBlockEncodingType = fileInfo.get(INDEX_BLOCK_ENCODING);
    if (dataBlockEncodingType != null) {
      String dataBlockEncodingStr = Bytes.toString(dataBlockEncodingType);
      try {
        encoding = IndexBlockEncoding.valueOf(dataBlockEncodingStr);
      } catch (IllegalArgumentException ex) {
        throw new IOException(
          "Invalid data block encoding type in file info: " + dataBlockEncodingStr, ex);
      }
    }

    if (encoding == IndexBlockEncoding.NONE) {
      return NoOpIndexBlockEncoder.INSTANCE;
    }
    return new HFileIndexBlockEncoderImpl(encoding);
  }
Do index block encoding with specified options.
@param encoding What kind of data block encoding will be used.
hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileIndexBlockEncoderImpl.java