code: public static InputStream asUncompressedInputStream(InputStream is) throws IOException {
          final InputStream bufferedInputStream = asBufferedInputStream(is);
          assert bufferedInputStream.markSupported();
  
          bufferedInputStream.mark(2);
          byte[] buf = new byte[2];
          int bytesRead;
          try {
              bytesRead = bufferedInputStream.read(buf);
          } finally {
              bufferedInputStream.reset();
          }
          if (bytesRead == 2) {
              final int byteMask = 0xff;
              final int byteWidth = 8;
              int magic = (buf[1] & byteMask) << byteWidth | (buf[0] & byteMask);
              if (magic == GZIPInputStream.GZIP_MAGIC) {
                  return new GZIPInputStream(bufferedInputStream);
              }
          }
          return bufferedInputStream;
      }
docs: Ensures that the returned stream is an uncompressed version of the supplied input stream.
  <p>
  This method first tries to read the first two bytes from the stream, then resets the stream. If the first two
  bytes equal the GZip magic number (see {@link GZIPInputStream#GZIP_MAGIC}), the supplied stream is wrapped in a
  {@link GZIPInputStream}. Otherwise, the stream is returned as-is, but possibly in a buffered version (see {@link
  #asBufferedInputStream(InputStream)}).
  
  @param is
  the input stream
  
  @return an uncompressed version of {@code is}
  
  @throws IOException
  if reading the magic number fails