@FunctionalInterface public interface SftpVersionSelector
Modifier and Type | Interface and Description |
---|---|
static class |
SftpVersionSelector.NamedVersionSelector
Wraps a
SftpVersionSelector and assigns it a name. |
Modifier and Type | Field and Description |
---|---|
static SftpVersionSelector.NamedVersionSelector |
CURRENT
An
SftpVersionSelector that returns the current version |
static SftpVersionSelector.NamedVersionSelector |
MAXIMUM
An
SftpVersionSelector that returns the maximum available version |
static SftpVersionSelector.NamedVersionSelector |
MINIMUM
An
SftpVersionSelector that returns the minimum available version |
Modifier and Type | Method and Description |
---|---|
static SftpVersionSelector.NamedVersionSelector |
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.NamedVersionSelector |
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.NamedVersionSelector |
preferredVersionSelector(Iterable<? extends 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 |
static SftpVersionSelector.NamedVersionSelector |
resolveVersionSelector(String selector)
Parses the input string to see if it matches one of the "known" selectors names (case insensitive).
|
int |
selectVersion(ClientSession session,
boolean initial,
int current,
List<Integer> available) |
static final SftpVersionSelector.NamedVersionSelector CURRENT
SftpVersionSelector
that returns the current versionstatic final SftpVersionSelector.NamedVersionSelector MAXIMUM
SftpVersionSelector
that returns the maximum available versionstatic final SftpVersionSelector.NamedVersionSelector MINIMUM
SftpVersionSelector
that returns the minimum available versionint selectVersion(ClientSession session, boolean initial, int current, List<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.NamedVersionSelector fixedVersionSelector(int version)
version
- The requested versionSftpVersionSelector.NamedVersionSelector
wrapping the requested versionstatic SftpVersionSelector.NamedVersionSelector 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.NamedVersionSelector
that attempts to select the most preferred version that is also
listed as available.static SftpVersionSelector.NamedVersionSelector preferredVersionSelector(Iterable<? extends 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.NamedVersionSelector
that attempts to select the most preferred version that is also
listed as available.static SftpVersionSelector.NamedVersionSelector resolveVersionSelector(String selector)
fixed
version.
Otherwise, assumes a comma separated list of versions in preferred order.selector
- The selector value - if null
/empty then returns CURRENT
SftpVersionSelector.NamedVersionSelector
Copyright © 2008–2024 The Apache Software Foundation. All rights reserved.