private static void checkMagicString(InputStream in) throws IOException {
    byte[] magic = new byte[3];
    magic[0] = (byte) in.read();
    magic[1] = (byte) in.read();
    magic[2] = (byte) in.read();

    if (!Arrays.equals(magic, MAGIC)) {
      throw new IllegalArgumentException("The input stream is not a HyperLogLog stream.");
    }
  }
Check if the specified input stream is actually a HLL stream
@param in
         - input stream
@throws IOException
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/common/ndv/hll/HyperLogLogUtils.java