public Builder withExtended(String type, String data) { mask |= Flag.EXTENDED.get(); ext.put(type, data); return this; }
public FileAttributes readFileAttributes() throws SFTPException { final FileAttributes.Builder builder = new FileAttributes.Builder(); try { final int mask = readUInt32AsInt(); if (FileAttributes.Flag.SIZE.isSet(mask)) builder.withSize(readUInt64()); if (FileAttributes.Flag.UIDGID.isSet(mask)) builder.withUIDGID(readUInt32AsInt(), readUInt32AsInt()); if (FileAttributes.Flag.MODE.isSet(mask)) builder.withPermissions(readUInt32AsInt()); if (FileAttributes.Flag.ACMODTIME.isSet(mask)) builder.withAtimeMtime(readUInt32AsInt(), readUInt32AsInt()); if (FileAttributes.Flag.EXTENDED.isSet(mask)) { final int extCount = readUInt32AsInt(); for (int i = 0; i < extCount; i++) builder.withExtended(readString(), readString()); } } catch (BufferException be) { throw new SFTPException(be); } return builder.build(); }
public FileAttributes readFileAttributes() throws SFTPException { final FileAttributes.Builder builder = new FileAttributes.Builder(); try { final int mask = readUInt32AsInt(); if (FileAttributes.Flag.SIZE.isSet(mask)) builder.withSize(readUInt64()); if (FileAttributes.Flag.UIDGID.isSet(mask)) builder.withUIDGID(readUInt32AsInt(), readUInt32AsInt()); if (FileAttributes.Flag.MODE.isSet(mask)) builder.withPermissions(readUInt32AsInt()); if (FileAttributes.Flag.ACMODTIME.isSet(mask)) builder.withAtimeMtime(readUInt32AsInt(), readUInt32AsInt()); if (FileAttributes.Flag.EXTENDED.isSet(mask)) { final int extCount = readUInt32AsInt(); for (int i = 0; i < extCount; i++) builder.withExtended(readString(), readString()); } } catch (BufferException be) { throw new SFTPException(be); } return builder.build(); }
public boolean has(Flag flag) { return flag.isSet(mask); }
public boolean has(Flag flag) { return flag.isSet(mask); }
public Builder withExtended(Map<String, String> ext) { mask |= Flag.EXTENDED.get(); this.ext.putAll(ext); return this; }
public Builder withUIDGID(int uid, int gid) { mask |= Flag.UIDGID.get(); this.uid = uid; this.gid = gid; return this; }
public Builder withAtimeMtime(long atime, long mtime) { mask |= Flag.ACMODTIME.get(); this.atime = atime; this.mtime = mtime; return this; }
public Builder withPermissions(Set<FilePermission> perms) { mask |= Flag.MODE.get(); this.mode = new FileMode((mode != null ? mode.getTypeMask() : 0) | FilePermission.toMask(perms)); return this; }
public Builder withAtimeMtime(long atime, long mtime) { mask |= Flag.ACMODTIME.get(); this.atime = atime; this.mtime = mtime; return this; }
public Builder withExtended(String type, String data) { mask |= Flag.EXTENDED.get(); ext.put(type, data); return this; }
public Builder withPermissions(int perms) { mask |= Flag.MODE.get(); this.mode = new FileMode((mode != null ? mode.getTypeMask() : 0) | perms); return this; }
public Builder withPermissions(Set<FilePermission> perms) { mask |= Flag.MODE.get(); this.mode = new FileMode((mode != null ? mode.getTypeMask() : 0) | FilePermission.toMask(perms)); return this; }
public Builder withExtended(Map<String, String> ext) { mask |= Flag.EXTENDED.get(); this.ext.putAll(ext); return this; }
public Builder withSize(long size) { mask |= Flag.SIZE.get(); this.size = size; return this; }
public Builder withPermissions(int perms) { mask |= Flag.MODE.get(); this.mode = new FileMode((mode != null ? mode.getTypeMask() : 0) | perms); return this; }
public Builder withSize(long size) { mask |= Flag.SIZE.get(); this.size = size; return this; }
public Builder withType(FileMode.Type type) { mask |= Flag.MODE.get(); this.mode = new FileMode(type.toMask() | (mode != null ? mode.getPermissionsMask() : 0)); return this; }
public Builder withType(FileMode.Type type) { mask |= Flag.MODE.get(); this.mode = new FileMode(type.toMask() | (mode != null ? mode.getPermissionsMask() : 0)); return this; }
public Builder withUIDGID(int uid, int gid) { mask |= Flag.UIDGID.get(); this.uid = uid; this.gid = gid; return this; }