Package com.atlassian.bamboo.util
Class HtmlUtils
- java.lang.Object
-
- com.atlassian.bamboo.util.HtmlUtils
-
public class HtmlUtils extends Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static String
addPrefixToLines(String prefix, String input)
static String
appendUrls(String url1, String url2)
static String
colorizeAnsiToHtml(String line)
static String
encodeUrl(String url)
Deprecated.since 5.14 use com.atlassian.bamboo.utils.EscapeChars#forUrl insteadstatic @NotNull String
getAsPreformattedText(@Nullable Object o)
Escapes the passed object as a string.static String
getFirstNCharactersWithTrailer(@Nullable String s, int chars)
static String
getFirstNLines(String s, int lines)
Returns the first n lines of the passed stringstatic String
getFirstNLinesWithTrailer(String s, int lines)
static HtmlUtils
getInstanceForFreemarker()
static String
getTextAsHtml(Object o)
Changes text to html, this includes escaping any html specific characters, placing href tags around links and replacing new lines with break tags
-
-
-
Field Detail
-
WBR
public static final String WBR
- See Also:
- Constant Field Values
-
BSLASH
public static final String BSLASH
- See Also:
- Constant Field Values
-
-
Method Detail
-
getAsPreformattedText
@NotNull public static @NotNull String getAsPreformattedText(@Nullable @Nullable Object o)
Escapes the passed object as a string. The method:- Escapes HTML
- replaces all double spaces with chars
- Allows \/ characters to have line breaks after them
- Parameters:
o
- - Any object, can be null- Returns:
- escaped string
-
getTextAsHtml
public static String getTextAsHtml(Object o)
Changes text to html, this includes escaping any html specific characters, placing href tags around links and replacing new lines with break tags- Parameters:
o
- Any object, can be null- Returns:
- Formatted String
-
getFirstNLines
public static String getFirstNLines(String s, int lines)
Returns the first n lines of the passed string- Parameters:
s
- - can be nulllines
- must be > 0- Returns:
- first n lines inclusive. So if there are no new line characters, the entire string is returned. Empty string if null was passed
-
getFirstNCharactersWithTrailer
public static String getFirstNCharactersWithTrailer(@Nullable @Nullable String s, int chars)
-
encodeUrl
@Deprecated public static String encodeUrl(String url)
Deprecated.since 5.14 use com.atlassian.bamboo.utils.EscapeChars#forUrl instead- Parameters:
url
-
-
getInstanceForFreemarker
public static HtmlUtils getInstanceForFreemarker()
-
-