Class HtmlUtils

java.lang.Object
com.atlassian.bamboo.util.HtmlUtils

public class HtmlUtils extends Object
  • Field Details

  • Method Details

    • getAsPreformattedText

      @NotNull public static @NotNull String getAsPreformattedText(@Nullable @Nullable Object o)
      Escapes the passed object as a string. The method:
      1. Escapes HTML
      2. replaces all double spaces with   chars
      3. 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 null
      lines - 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
    • getFirstNLinesWithTrailer

      public static String getFirstNLinesWithTrailer(String s, int lines)
    • getFirstNCharactersWithTrailer

      public static String getFirstNCharactersWithTrailer(@Nullable @Nullable String s, int chars)
    • appendUrls

      public static String appendUrls(String url1, String url2)
    • colorizeAnsiToHtml

      public static String colorizeAnsiToHtml(String line)
    • encodeUrl

      @Deprecated public static String encodeUrl(String url)
      Deprecated.
      since 5.14 use com.atlassian.bamboo.utils.EscapeChars#forUrl instead
      Parameters:
      url -
    • addPrefixToLines

      public static String addPrefixToLines(String prefix, String input)
    • getInstanceForFreemarker

      public static HtmlUtils getInstanceForFreemarker()