code: public static boolean isCompressed(PushbackInputStream pushbackInputStream) throws IOException {
        if (pushbackInputStream == null) {
           return false;
        }
        byte[] buffer = new byte[2];
        int read = pushbackInputStream.read(buffer);
        boolean isCompressed = false;
  
        if (read == 2) {
           isCompressed = ((buffer[0] == (byte) (GZIPInputStream.GZIP_MAGIC)) && (buffer[1] == (byte) (GZIPInputStream.GZIP_MAGIC >> 8)));
        }
  
        if (read != -1) {
           pushbackInputStream.unread(buffer, 0, read);
        }
  
        return isCompressed;
     }
docs: Is compressed boolean.
  
  @param pushbackInputStream the pushback input stream
  @return the boolean
  @throws IOException the io exception