Class CatalogHelper


  • public final class CatalogHelper
    extends Object
    • Method Detail

      • loadLines

        public static void loadLines​(InputStream in,
                                     List<String> lines)
                              throws IOException
        Loads the entire stream into memory as a String and returns it.

        Notice: This implementation appends a \n as line terminator at the of the text.

        Warning, don't use for crazy big streams :)

        Throws:
        IOException
      • loadLines

        public static List<String> loadLines​(InputStream in)
                                      throws IOException
        Loads the entire stream into memory as a String and returns it.

        Notice: This implementation appends a \n as line terminator at the of the text.

        Warning, don't use for crazy big streams :)

        Throws:
        IOException
      • loadText

        public static String loadText​(InputStream in)
                               throws IOException
        Loads the entire stream into memory as a String and returns it.

        Notice: This implementation appends a \n as line terminator at the of the text.

        Warning, don't use for crazy big streams :)

        Throws:
        IOException
      • matchWildcard

        public static boolean matchWildcard​(String name,
                                            String pattern)
        Matches the name with the pattern.
        Parameters:
        name - the name
        pattern - the pattern
        Returns:
        true if matched, or false if not
      • after

        public static String after​(String text,
                                   String after)
        Returns the string after the given token
        Parameters:
        text - the text
        after - the token
        Returns:
        the text after the token, or null if text does not contain the token
      • before

        public static String before​(String text,
                                    String before)
        Returns the string before the given token
        Parameters:
        text - the text
        before - the token
        Returns:
        the text before the token, or null if text does not contain the token
      • between

        public static String between​(String text,
                                     String after,
                                     String before)
        Returns the string between the given tokens
        Parameters:
        text - the text
        after - the before token
        before - the after token
        Returns:
        the text between the tokens, or null if text does not contain the tokens
      • isEmpty

        public static boolean isEmpty​(Object value)
        Tests whether the value is null or an empty string.
        Parameters:
        value - the value, if its a String it will be tested for text length as well
        Returns:
        true if empty
      • isNotEmpty

        public static boolean isNotEmpty​(Object value)
        Tests whether the value is not null or an empty string.
        Parameters:
        value - the value, if its a String it will be tested for text length as well
        Returns:
        true if not empty
      • removeLeadingAndEndingQuotes

        public static String removeLeadingAndEndingQuotes​(String s)
        Removes all leading and ending quotes (single and double) from the string
        Parameters:
        s - the string
        Returns:
        the string without leading and ending quotes (single and double)