@SuppressWarnings("PMD.MissingBreakInSwitch") private void download(final TransferListener listener, final RemoteResourceInfo remote, final LocalDestFile local) throws IOException { final LocalDestFile adjustedFile; switch (remote.getAttributes().getType()) { case DIRECTORY: adjustedFile = downloadDir(listener.directory(remote.getName()), remote, local); break; case UNKNOWN: log.warn("Server did not supply information about the type of file at `{}` " + "-- assuming it is a regular file!", remote.getPath()); case REGULAR: adjustedFile = downloadFile(listener.file(remote.getName(), remote.getAttributes().getSize()), remote, local); break; default: throw new IOException(remote + " is not a regular file or directory"); } if (getPreserveAttributes()) copyAttributes(remote, adjustedFile); }
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()); } }
@SuppressWarnings("PMD.MissingBreakInSwitch") private void download(final TransferListener listener, final RemoteResourceInfo remote, final LocalDestFile local) throws IOException { final LocalDestFile adjustedFile; switch (remote.getAttributes().getType()) { case DIRECTORY: adjustedFile = downloadDir(listener.directory(remote.getName()), remote, local); break; case UNKNOWN: log.warn("Server did not supply information about the type of file at `{}` " + "-- assuming it is a regular file!", remote.getPath()); case REGULAR: adjustedFile = downloadFile(listener.file(remote.getName(), remote.getAttributes().getSize()), remote, local); break; default: throw new IOException(remote + " is not a regular file or directory"); } if (getPreserveAttributes()) copyAttributes(remote, adjustedFile); }
private void download(final TransferListener listener, final RemoteResourceInfo remote, final LocalDestFile local) throws IOException { final LocalDestFile adjustedFile; switch (remote.getAttributes().getType()) { case DIRECTORY: adjustedFile = downloadDir(listener.directory(remote.getName()), remote, local); break; case UNKNOWN: log.warn("Server did not supply information about the type of file at `{}` " + "-- assuming it is a regular file!", remote.getPath()); case REGULAR: adjustedFile = downloadFile(listener.file(remote.getName(), remote.getAttributes().getSize()), remote, local); break; default: throw new IOException(remote + " is not a regular file or directory"); } if (getPreserveAttributes()) copyAttributes(remote, adjustedFile); }
final PathAttributes attr = attributes.toAttributes(f.getAttributes()); final EnumSet<Path.Type> type = EnumSet.noneOf(Path.Type.class); if(f.getAttributes().getType().equals(FileMode.Type.DIRECTORY)) { type.add(Path.Type.directory); if(f.getAttributes().getType().equals(FileMode.Type.REGULAR)) { type.add(Path.Type.file); if(f.getAttributes().getType().equals(FileMode.Type.SYMLINK)) { type.add(Path.Type.symboliclink);
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 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()); } }