Package org.apache.sshd.scp.common
Class ScpLocation
java.lang.Object
org.apache.sshd.scp.common.ScpLocation
- All Implemented Interfaces:
Serializable,Cloneable,MutableUserHolder,UsernameHolder
Represents a local or remote SCP location in the format "user@host:path" or
"scp://[user@]host[:port][/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.
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionScpLocation(String locSpec) ScpLocation(String username, String host, int port, String path) ScpLocation(String username, String host, String path) -
Method Summary
Modifier and TypeMethodDescriptionclone()booleangetHost()getPath()intgetPort()inthashCode()booleanisLocal()static ScpLocationParses a local or remote SCP location in the format "user@host:path" or "scp://[user@]host[:port][/path]"intResolves the effective username to use for a remote location.voidvoidvoidsetPort(int port) voidsetUsername(String username) toString()static <L extends ScpLocation>
LParses a local or remote SCP location in the format "user@host:path" or "scp://[user@]host[:port][/path]"
-
Field Details
-
SCHEME
- See Also:
-
HOST_PART_SEPARATOR
public static final char HOST_PART_SEPARATOR- See Also:
-
USERNAME_PART_SEPARATOR
public static final char USERNAME_PART_SEPARATOR- See Also:
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
host
-
username
-
path
-
port
private int port
-
-
Constructor Details
-
ScpLocation
public ScpLocation() -
ScpLocation
- Parameters:
locSpec- The location specification - ignored ifnull/empty- Throws:
IllegalArgumentException- if invalid specification- See Also:
-
ScpLocation
-
ScpLocation
-
-
Method Details
-
getHost
-
setHost
-
isLocal
public boolean isLocal() -
getPort
public int getPort() -
setPort
public void setPort(int port) -
resolvePort
public int resolvePort() -
getUsername
- Specified by:
getUsernamein interfaceUsernameHolder- Returns:
- The attached username - may be
null/empty if holder not yet initialized
-
setUsername
- Specified by:
setUsernamein interfaceMutableUserHolder
-
resolveUsername
Resolves the effective username to use for a remote location. If username not set then uses the current username- Returns:
- The resolved username
- See Also:
-
getPath
-
setPath
-
hashCode
public int hashCode() -
equals
-
clone
-
toString
-
parse
Parses a local or remote SCP location in the format "user@host:path" or "scp://[user@]host[:port][/path]"- Parameters:
locSpec- The location specification - ignored ifnull/empty- Returns:
- The
ScpLocationornullif no specification provider - Throws:
IllegalArgumentException- if invalid specification- See Also:
-
update
Parses a local or remote SCP location in the format "user@host:path" or "scp://[user@]host[:port][/path]"- Type Parameters:
L- Type ofScpLocationbeing updated- Parameters:
spec- The location specification - ignored ifnull/emptylocation- TheScpLocationto update - nevernull- Returns:
- The updated location (unless no specification)
- Throws:
IllegalArgumentException- if invalid specification
-