@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 maximum 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, int, List) method is invoked |
static SftpVersionSelector |
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, int, List) method is invoked |
int |
selectVersion(ClientSession session,
int current,
List<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 maximum available versionint selectVersion(ClientSession session, int current, List<Integer> available)
session
- The ClientSession
through which the SFTP connection is madecurrent
- 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, 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(Iterable<? extends Number> preferred)
selectVersion(ClientSession, 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.Copyright © 2008–2022 The Apache Software Foundation. All rights reserved.