encode method

List<int>? encode(
  1. Archive archive, {
  2. int level = Deflate.BEST_SPEED,
  3. OutputStreamBase? output,
  4. DateTime? modified,
  5. bool autoClose = false,
})
inherited

Implementation

List<int>? encode(Archive archive,
    {int level = Deflate.BEST_SPEED,
    OutputStreamBase? output,
    DateTime? modified,
    bool autoClose = false}) {
  output ??= OutputStream();

  startEncode(output, level: level, modified: modified);
  for (final file in archive.files) {
    addFile(file, autoClose: autoClose);
  }
  endEncode(comment: archive.comment);

  if (output is OutputStream) {
    return output.getBytes();
  }

  return null;
}