SftpFileAttrs.readFrom constructor
SftpFileAttrs.readFrom(
- SSHMessageReader reader
Implementation
factory SftpFileAttrs.readFrom(SSHMessageReader reader) {
final flags = reader.readUint32();
final size = flags.has(_Flags.size) ? reader.readUint64() : null;
final uid = flags.has(_Flags.uidgid) ? reader.readUint32() : null;
final gid = flags.has(_Flags.uidgid) ? reader.readUint32() : null;
final perms = flags.has(_Flags.permissions) ? reader.readUint32() : null;
final atime = flags.has(_Flags.acmodtime) ? reader.readUint32() : null;
final mtime = flags.has(_Flags.acmodtime) ? reader.readUint32() : null;
final extended = flags.has(_Flags.extended) ? <String, String>{} : null;
if (extended != null) {
final count = reader.readUint32();
for (var i = 0; i < count; i++) {
final key = reader.readUtf8();
final value = reader.readUtf8();
extended[key] = value;
}
}
return SftpFileAttrs(
size: size,
userID: uid,
groupID: gid,
mode: perms != null ? SftpFileMode.value(perms) : null,
accessTime: atime,
modifyTime: mtime,
extended: extended,
);
}