add method

void add (
  1. ArchiveFile file
)

Implementation

void add(ArchiveFile file) {
  if (_output_stream == null) {
    return;
  }

  // GNU tar files store extra long file names in a separate file
  if (file.name.length > 100) {
    final ts = TarFile();
    ts.filename = '././@LongLink';
    ts.fileSize = file.name.length;
    ts.mode = 0;
    ts.ownerId = 0;
    ts.groupId = 0;
    ts.lastModTime = 0;
    ts.content = file.name;
    ts.write(_output_stream);
  }

  final ts = TarFile();
  ts.filename = file.name;
  ts.fileSize = file.size;
  ts.mode = file.mode;
  ts.ownerId = file.ownerId;
  ts.groupId = file.groupId;
  ts.lastModTime = file.lastModTime;
  ts.content = file.content;
  ts.write(_output_stream);
}