code: public static void compressString(InputStream inputStream, OutputStream outputStream) throws IOException {
          try (ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream()) {
              fillExportStreamCompress(inputStream, byteArrayOutputStream);
              // to do -> make it in chunks
              String result = getStringFromEncode(byteArrayOutputStream.toByteArray());
              try (PrintWriter printWriter = new PrintWriter(outputStream)) {
                  printWriter.write(result);
              }
          }
      }
docs: The method compresses the big strings using gzip - low memory via Streams
  
  @param inputStream
  @param outputStream
  @throws IOException