Interface SftpVersionSelector

  • All Known Implementing Classes:
    SftpVersionSelector.NamedVersionSelector
    Functional Interface:
    This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

    @FunctionalInterface
    public interface SftpVersionSelector
    • Method Detail

      • selectVersion

        int selectVersion​(ClientSession session,
                          boolean initial,
                          int current,
                          java.util.List<java.lang.Integer> available)
        Parameters:
        session - The ClientSession through which the SFTP connection is made
        initial - 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 server
        available - Extra versions available - may be empty and/or contain only the current one
        Returns:
        The new requested version - if same as current, then nothing is done
      • fixedVersionSelector

        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. If the requested version is not reported as available then an exception will be eventually thrown by the client during re-negotiation phase.
        Parameters:
        version - The requested version
        Returns:
        The SftpVersionSelector.NamedVersionSelector wrapping the requested version
      • resolveVersionSelector

        static SftpVersionSelector.NamedVersionSelector resolveVersionSelector​(java.lang.String selector)
        Parses the input string to see if it matches one of the "known" selectors names (case insensitive). If not, then checks if it is a single number and uses it as a fixed version. Otherwise, assumes a comma separated list of versions in preferred order.
        Parameters:
        selector - The selector value - if null/empty then returns CURRENT
        Returns:
        Parsed SftpVersionSelector.NamedVersionSelector