public class ScpLocation extends Object implements MutableUserHolder, Serializable, Cloneable
Modifier and Type | Field and Description |
---|---|
static char |
HOST_PART_SEPARATOR |
static String |
SCHEME |
static char |
USERNAME_PART_SEPARATOR |
Constructor and Description |
---|
ScpLocation() |
ScpLocation(String locSpec) |
ScpLocation(String username,
String host,
int port,
String path) |
ScpLocation(String username,
String host,
String path) |
Modifier and Type | Method and Description |
---|---|
ScpLocation |
clone() |
boolean |
equals(Object obj) |
String |
getHost() |
String |
getPath() |
int |
getPort() |
String |
getUsername() |
int |
hashCode() |
boolean |
isLocal() |
static ScpLocation |
parse(String locSpec)
Parses a local or remote SCP location in the format "user@host:path" or
"scp://[user@]host[:port][/path]"
|
int |
resolvePort() |
String |
resolveUsername()
Resolves the effective username to use for a remote location.
|
void |
setHost(String host) |
void |
setPath(String path) |
void |
setPort(int port) |
void |
setUsername(String username) |
String |
toString() |
static <L extends ScpLocation> |
update(String spec,
L location)
Parses a local or remote SCP location in the format "user@host:path" or
"scp://[user@]host[:port][/path]"
|
public static final String SCHEME
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 int getPort()
public void setPort(int port)
public int resolvePort()
public String getUsername()
getUsername
in interface UsernameHolder
null
/empty if holder not yet initializedpublic void setUsername(String username)
setUsername
in interface MutableUserHolder
public String resolveUsername()
getUsername()
,
OsUtils.getCurrentUser()
public String getPath()
public void setPath(String path)
public ScpLocation clone()
public static ScpLocation parse(String locSpec)
locSpec
- 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 spec, L location)
L
- Type of ScpLocation
being updatedspec
- The location specification - ignored if null
/emptylocation
- The ScpLocation
to update - never null
IllegalArgumentException
- if invalid specificationCopyright © 2008–2024 The Apache Software Foundation. All rights reserved.