public void writeCompressData()

in backup-core/src/main/java/org/apache/iotdb/backup/core/service/ExportPipelineService.java [840:866]


  public void writeCompressData(List<String> list, OutputStream out, ExportModel exportModel) {

    String[] ar = new String[list.size()];
    ar = list.toArray(ar);
    byte[] originalBytes = ToByteArrayUtils.getByteArray(ar);
    try {
      byte[] nowBytes;
      switch (exportModel.getCompressEnum()) {
        case SNAPPY:
          nowBytes = Snappy.compress(originalBytes);
          break;
        case LZ4:
          LZ4Factory factory = LZ4Factory.fastestInstance();
          LZ4Compressor compressor = factory.fastCompressor();
          nowBytes = compressor.compress(originalBytes);
          break;
        default:
          nowBytes = ICompressor.GZIPCompress.compress(originalBytes);
      }
      out.write(ToByteArrayUtils.intToBytes(originalBytes.length));
      out.write(ToByteArrayUtils.intToBytes(nowBytes.length));
      out.write(nowBytes);
      out.flush();
    } catch (IOException e) {
      log.error("", e);
    }
  }