code: public static void decompressString(InputStream inputStream, OutputStream outputStream) throws IOException {
          try (InputStream bufferedInputStream = new BufferedInputStream(inputStream);
               PrintWriter printWriter = new PrintWriter(outputStream);) {
              byte[] buffer = new byte[BYTES_BUFFER_SIZE];
              int len;
              while ((len = bufferedInputStream.read(buffer)) > 0) {
                  String val = new String(buffer, StandardCharsets.UTF_8);
                  String str = decompressString(val);
                  printWriter.write(str);
              }
          }
      }
docs: The method decompresses the big strings using gzip - low memory via Streams
  
  @param inputStream
  @param outputStream
  @throws IOException