code: public String toRemote(final String host, final File localFile) {
      if (this.remoteName != null && (this.hosts == null || this.hosts.contains(host))) {
        try {
          final String canonical = localFile.getCanonicalPath();
          if (canonical.startsWith(this.canonicalPath) && isActive()) {
              return this.remoteName
                  + canonical.substring(this.canonicalPath.length()).replace(File.separatorChar, this.remoteSeparator);
          }
        } catch (final IOException ex) {
          return null;
        }
      }
      return null;
    }
docs: Converts the local file name to the remote name for the same file.
  
  @param host
  host
  @param localFile
  local file
  @return remote name for local file, null if unknown.