Package org.apache.camel.catalog.impl
Class CatalogHelper
- java.lang.Object
-
- org.apache.camel.catalog.impl.CatalogHelper
-
public final class CatalogHelper extends Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
after(String text, String after)
Returns the string after the given tokenstatic String
before(String text, String before)
Returns the string before the given tokenstatic String
between(String text, String after, String before)
Returns the string between the given tokensstatic boolean
isEmpty(Object value)
Tests whether the value is null or an empty string.static boolean
isNotEmpty(Object value)
Tests whether the value is not null or an empty string.static List<String>
loadLines(InputStream in)
Loads the entire stream into memory as a String and returns it.static void
loadLines(InputStream in, List<String> lines)
Loads the entire stream into memory as a String and returns it.static String
loadText(InputStream in)
Loads the entire stream into memory as a String and returns it.static boolean
matchWildcard(String name, String pattern)
Matches the name with the pattern.static String
removeLeadingAndEndingQuotes(String s)
Removes all leading and ending quotes (single and double) from the string
-
-
-
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 namepattern
- 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 textafter
- 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 textbefore
- 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 textafter
- the before tokenbefore
- 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
-
-