code: public static FSImageCompression readCompressionHeader(
      Configuration conf,
      DataInputStream dis) throws IOException
    {
      boolean isCompressed = dis.readBoolean();
  
      if (!isCompressed) {
        return createNoopCompression();
      } else {
        String codecClassName = Text.readString(dis);
        return createCompression(conf, codecClassName);
      }
    }
docs: Create a compression instance based on a header read from an input stream.
  @throws IOException if the specified codec is not available or the
  underlying IO fails.