public class ScpLocation extends java.lang.Object implements MutableUserHolder, java.io.Serializable, java.lang.Cloneable
user@host:path for a remote path and a simple path
for a local one. If user is omitted for a remote path then current user is used.| Modifier and Type | Field and Description |
|---|---|
private java.lang.String |
host |
static char |
HOST_PART_SEPARATOR |
private java.lang.String |
path |
private static long |
serialVersionUID |
private java.lang.String |
username |
static char |
USERNAME_PART_SEPARATOR |
| Constructor and Description |
|---|
ScpLocation() |
ScpLocation(java.lang.String locSpec) |
| Modifier and Type | Method and Description |
|---|---|
ScpLocation |
clone() |
boolean |
equals(java.lang.Object obj) |
java.lang.String |
getHost() |
java.lang.String |
getPath() |
java.lang.String |
getUsername() |
int |
hashCode() |
boolean |
isLocal() |
static ScpLocation |
parse(java.lang.String locSpec)
Parses a local or remote SCP location in the format
user@host:path |
java.lang.String |
resolveUsername()
Resolves the effective username to use for a remote location.
|
void |
setHost(java.lang.String host) |
void |
setPath(java.lang.String path) |
void |
setUsername(java.lang.String username) |
java.lang.String |
toString() |
static <L extends ScpLocation> |
update(java.lang.String locSpec,
L location)
Parses a local or remote SCP location in the format
user@host:path |
public static final char HOST_PART_SEPARATOR
public static final char USERNAME_PART_SEPARATOR
private static final long serialVersionUID
private java.lang.String host
private java.lang.String username
private java.lang.String path
public ScpLocation()
public ScpLocation(java.lang.String locSpec)
locSpec - The location specification - ignored if null/emptyjava.lang.IllegalArgumentException - if invalid specificationupdate(String, ScpLocation)public java.lang.String getHost()
public void setHost(java.lang.String host)
public boolean isLocal()
public java.lang.String getUsername()
getUsername in interface UsernameHoldernull/empty if holder not yet initializedpublic void setUsername(java.lang.String username)
setUsername in interface MutableUserHolderpublic java.lang.String resolveUsername()
getUsername(),
OsUtils.getCurrentUser()public java.lang.String getPath()
public void setPath(java.lang.String path)
public int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic ScpLocation clone()
clone in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Objectpublic static ScpLocation parse(java.lang.String locSpec)
user@host:pathlocSpec - The location specification - ignored if null/emptyScpLocation or null if no specification providerjava.lang.IllegalArgumentException - if invalid specificationupdate(String, ScpLocation)public static <L extends ScpLocation> L update(java.lang.String locSpec, L location)
user@host:pathL - Type of ScpLocation being updatedlocSpec - The location specification - ignored if null/emptylocation - The ScpLocation to update - never nulljava.lang.IllegalArgumentException - if invalid specification