docs: public InputStream fetch(HttpURLConnection connection, boolean readErrorStreamNoException) throws IOException {
          // create connection but before reading get the correct inputstream based on the compression and if error
          connection.connect();
  
          InputStream is;
          if (readErrorStreamNoException && connection.getResponseCode() >= 400 && connection.getErrorStream() != null)
              is = connection.getErrorStream();
          else
              is = connection.getInputStream();
  
          if (is == null)
              throw new IOException("Stream is null. Message:" + connection.getResponseMessage());
  
          // wrap
          try {
              String encoding = connection.getContentEncoding();
              if (encoding != null && encoding.equalsIgnoreCase("gzip"))
                  is = new GZIPInputStream(is);
              else if (encoding != null && encoding.equalsIgnoreCase("deflate"))
                  is = new InflaterInputStream(is, new Inflater(true));
          } catch (IOException ex) {
          }
  
          return is;
      }