public Builder withPermissions(int perms) { mask |= Flag.MODE.get(); this.mode = new FileMode((mode != null ? mode.getTypeMask() : 0) | perms); 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 FileMode(int mask) { this.mask = mask; this.type = Type.fromMask(getTypeMask()); this.perms = FilePermission.fromMask(getPermissionsMask()); }
public FileMode.Type getType() { return mode.getType(); }
private void copyAttributes(final RemoteResourceInfo remote, final LocalDestFile local) throws IOException { final FileAttributes attrs = remote.getAttributes(); local.setPermissions(attrs.getMode().getPermissionsMask()); if (attrs.has(FileAttributes.Flag.ACMODTIME)) { local.setLastAccessedTime(attrs.getAtime()); local.setLastModifiedTime(attrs.getMtime()); } }
private FileAttributes() { size = atime = mtime = uid = gid = mask = 0; mode = new FileMode(0); }
@Override public String toString() { final StringBuilder sb = new StringBuilder("["); if (has(Flag.SIZE)) sb.append("size=").append(size).append(";"); if (has(Flag.UIDGID)) sb.append("uid=").append(uid).append(",gid=").append(gid).append(";"); if (has(Flag.MODE)) sb.append("mode=").append(mode.toString()).append(";"); if (has(Flag.ACMODTIME)) sb.append("atime=").append(atime).append(",mtime=").append(mtime).append(";"); if (has(Flag.EXTENDED)) sb.append("ext=").append(ext); sb.append("]"); return sb.toString(); }
public Set<FilePermission> getPermissions() { return mode.getPermissions(); }
public byte[] toBytes() { Buffer.PlainBuffer buf = new Buffer.PlainBuffer(); buf.putUInt32(mask); if (has(Flag.SIZE)) buf.putUInt64(size); if (has(Flag.UIDGID)) { buf.putUInt32(uid); buf.putUInt32(gid); } if (has(Flag.MODE)) buf.putUInt32(mode.getMask()); if (has(Flag.ACMODTIME)) { buf.putUInt32(atime); buf.putUInt32(mtime); } if (has(Flag.EXTENDED)) { buf.putUInt32(ext.size()); for (Entry<String, String> entry : ext.entrySet()) { buf.putString(entry.getKey()); buf.putString(entry.getValue()); } } return buf.getCompactData(); }
private boolean isDirectory(final String remote) throws IOException { try { FileAttributes attrs = engine.stat(remote); return attrs.getMode().getType() == FileMode.Type.DIRECTORY; } catch (SFTPException e) { if (e.getStatusCode() == StatusCode.NO_SUCH_FILE) { log.debug("isDir: {} does not exist", remote); return false; } else { throw e; } } }
public FileMode(int mask) { this.mask = mask; this.type = Type.fromMask(getTypeMask()); this.perms = FilePermission.fromMask(getPermissionsMask()); }
private void copyAttributes(final RemoteResourceInfo remote, final LocalDestFile local) throws IOException { final FileAttributes attrs = remote.getAttributes(); local.setPermissions(attrs.getMode().getPermissionsMask()); if (attrs.has(FileAttributes.Flag.ACMODTIME)) { local.setLastAccessedTime(attrs.getAtime()); local.setLastModifiedTime(attrs.getMtime()); } }
private FileAttributes() { size = atime = mtime = uid = gid = mask = 0; mode = new FileMode(0); }
@Override public String toString() { final StringBuilder sb = new StringBuilder("["); if (has(Flag.SIZE)) sb.append("size=").append(size).append(";"); if (has(Flag.UIDGID)) sb.append("uid=").append(size).append(",gid=").append(gid).append(";"); if (has(Flag.MODE)) sb.append("mode=").append(mode.toString()).append(";"); if (has(Flag.ACMODTIME)) sb.append("atime=").append(atime).append(",mtime=").append(mtime).append(";"); if (has(Flag.EXTENDED)) sb.append("ext=").append(ext); sb.append("]"); return sb.toString(); }
public Set<FilePermission> getPermissions() { return mode.getPermissions(); }
public byte[] toBytes() { Buffer.PlainBuffer buf = new Buffer.PlainBuffer(); buf.putUInt32(mask); if (has(Flag.SIZE)) buf.putUInt64(size); if (has(Flag.UIDGID)) { buf.putUInt32(uid); buf.putUInt32(gid); } if (has(Flag.MODE)) buf.putUInt32(mode.getMask()); if (has(Flag.ACMODTIME)) { buf.putUInt32(atime); buf.putUInt32(mtime); } if (has(Flag.EXTENDED)) { buf.putUInt32(ext.size()); for (Entry<String, String> entry : ext.entrySet()) { buf.putString(entry.getKey()); buf.putString(entry.getValue()); } } return buf.getCompactData(); }
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 withType(FileMode.Type type) { mask |= Flag.MODE.get(); this.mode = new FileMode(type.toMask() | (mode != null ? mode.getPermissionsMask() : 0)); return this; }