public class ScpLocation extends Object implements MutableUserHolder, Serializable, 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 |
|---|---|
static char |
HOST_PART_SEPARATOR |
static char |
USERNAME_PART_SEPARATOR |
| Constructor and Description |
|---|
ScpLocation() |
ScpLocation(String locSpec) |
| Modifier and Type | Method and Description |
|---|---|
ScpLocation |
clone() |
boolean |
equals(Object obj) |
String |
getHost() |
String |
getPath() |
String |
getUsername() |
int |
hashCode() |
boolean |
isLocal() |
static ScpLocation |
parse(String locSpec)
Parses a local or remote SCP location in the format
user@host:path |
String |
resolveUsername()
Resolves the effective username to use for a remote location.
|
void |
setHost(String host) |
void |
setPath(String path) |
void |
setUsername(String username) |
String |
toString() |
static <L extends ScpLocation> |
update(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
public ScpLocation()
public ScpLocation(String locSpec)
locSpec - The location specification - ignored if null/emptyIllegalArgumentException - if invalid specificationupdate(String, ScpLocation)public String getHost()
public void setHost(String host)
public boolean isLocal()
public String getUsername()
getUsername in interface UsernameHoldernull/empty if holder
not yet initializedpublic void setUsername(String username)
setUsername in interface MutableUserHolderpublic String resolveUsername()
getUsername(),
OsUtils.getCurrentUser()public String getPath()
public void setPath(String path)
public ScpLocation clone()
public static ScpLocation parse(String locSpec)
user@host:pathlocSpec - The location specification - ignored if null/emptyScpLocation or null if no specification providerIllegalArgumentException - if invalid specificationupdate(String, ScpLocation)public static <L extends ScpLocation> L update(String locSpec, L location)
user@host:pathL - Type of ScpLocation being updatedlocSpec - The location specification - ignored if null/emptylocation - The ScpLocation to update - never nullIllegalArgumentException - if invalid specificationCopyright © 2008–2017 The Apache Software Foundation. All rights reserved.