@FunctionalInterface
public interface SftpVersionSelector
Modifier and Type | Interface and Description |
---|---|
static class |
SftpVersionSelector.NamedVersionSelector |
Modifier and Type | Field and Description |
---|---|
static SftpVersionSelector |
CURRENT
An
SftpVersionSelector that returns the current version |
static SftpVersionSelector |
MAXIMUM
An
SftpVersionSelector that returns the maximum available version |
static SftpVersionSelector |
MINIMUM
An
SftpVersionSelector that returns the minimum available version |
Modifier and Type | Method and Description |
---|---|
static SftpVersionSelector |
fixedVersionSelector(int version)
Creates a selector the always returns the requested (fixed version) regardless of what the current or reported
available versions are.
|
static SftpVersionSelector |
preferredVersionSelector(int... preferred)
Selects a version in order of preference - if none of the preferred versions is listed as available then an
exception is thrown when the
selectVersion(ClientSession, boolean, int, List) method
is invoked |
static SftpVersionSelector |
preferredVersionSelector(java.lang.Iterable<? extends java.lang.Number> preferred)
Selects a version in order of preference - if none of the preferred versions is listed as available then an
exception is thrown when the
selectVersion(ClientSession, boolean, int, List) method
is invoked |
int |
selectVersion(ClientSession session,
boolean initial,
int current,
java.util.List<java.lang.Integer> available) |
static final SftpVersionSelector CURRENT
SftpVersionSelector
that returns the current versionstatic final SftpVersionSelector MAXIMUM
SftpVersionSelector
that returns the maximum available versionstatic final SftpVersionSelector MINIMUM
SftpVersionSelector
that returns the minimum available versionint selectVersion(ClientSession session, boolean initial, int current, java.util.List<java.lang.Integer> available)
session
- The ClientSession
through which the SFTP connection is madeinitial
- If true
then this is the initial version sent via SSH_FXP_INIT
otherwise it is
a re-negotiation.current
- The current version negotiated with the serveravailable
- Extra versions available - may be empty and/or contain only the current onestatic SftpVersionSelector fixedVersionSelector(int version)
version
- The requested versionSftpVersionSelector
static SftpVersionSelector preferredVersionSelector(int... preferred)
selectVersion(ClientSession, boolean, int, List)
method
is invokedpreferred
- The preferred versions in decreasing order of preference (i.e., most preferred is 1st) - may
not be null
/emptySftpVersionSelector
that attempts to select the most preferred version that is also
listed as available.static SftpVersionSelector preferredVersionSelector(java.lang.Iterable<? extends java.lang.Number> preferred)
selectVersion(ClientSession, boolean, int, List)
method
is invokedpreferred
- The preferred versions in decreasing order of preference (i.e., most preferred is 1st)SftpVersionSelector
that attempts to select the most preferred version that is also
listed as available.