writeTo method

void writeTo(
  1. SSHMessageWriter writer
)

Implementation

void writeTo(SSHMessageWriter writer) {
  var flags = 0;
  if (size != null) flags |= _Flags.size;
  if (userID != null) flags |= _Flags.uidgid;
  if (groupID != null) flags |= _Flags.uidgid;
  if (mode != null) flags |= _Flags.permissions;
  if (accessTime != null) flags |= _Flags.acmodtime;
  if (modifyTime != null) flags |= _Flags.acmodtime;
  if (extended != null) flags |= _Flags.extended;

  writer.writeUint32(flags);
  if (size != null) writer.writeUint64(size!);
  if (userID != null) writer.writeUint32(userID!);
  if (groupID != null) writer.writeUint32(groupID!);
  if (mode != null) writer.writeUint32(mode!.value);
  if (accessTime != null) writer.writeUint32(accessTime!);
  if (modifyTime != null) writer.writeUint32(modifyTime!);

  if (extended != null) {
    writer.writeUint32(extended!.length);
    for (var pair in extended!.entries) {
      writer.writeUtf8(pair.key);
      writer.writeUtf8(pair.value);
    }
  }
}