Class SshShellOutputStringHelper


  • public final class SshShellOutputStringHelper
    extends Object
    • Method Detail

      • beforeLast

        public static String beforeLast​(String text,
                                        String before)
        Returns the string before the given token If this token is repeating, than return all text before the last token
        Parameters:
        text - the text
        before - the token which is expected to be repeated
        Returns:
        the text before the last token, or null if text does not contain the token
      • beforeLast

        public static <T> Optional<T> beforeLast​(String text,
                                                 String beforeLast,
                                                 Function<String,​T> mapper)
        Returns an object before the given last token
        Parameters:
        text - the text
        beforeLast - the last token
        mapper - a mapping function to convert the string before the token to type T
        Returns:
        an Optional describing the result of applying a mapping function to the text before the token.
      • betweenBeforeLast

        public static String betweenBeforeLast​(String text,
                                               String after,
                                               String beforeLast)
        Returns the string between the given tokens
        Parameters:
        text - the text
        after - is the starting token to skip the text before that.
        beforeLast - the last token
        Returns:
        the text between the tokens, or null if text does not contain the tokens
      • betweenBeforeLast

        public static <T> Optional<T> betweenBeforeLast​(String text,
                                                        String after,
                                                        String before,
                                                        Function<String,​T> mapper)
        Returns an object between the given token
        Parameters:
        text - the text
        after - the before last token
        before - the after token
        mapper - a mapping function to convert the string between the token to type T
        Returns:
        an Optional describing the result of applying a mapping function to the text between the token.