com.atlassian.bamboo.util
Class HtmlUtils

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

public class HtmlUtils
extends java.lang.Object


Field Summary
static java.lang.String BSLASH
           
static java.lang.String WBR
           
 
Method Summary
static java.lang.String addPrefixToLines(java.lang.String prefix, java.lang.String input)
           
static java.lang.String appendUrls(java.lang.String url1, java.lang.String url2)
           
static java.lang.String encodeUrl(java.lang.String url)
           
static java.lang.String getAsPreformattedText(java.lang.Object o)
          Escapes the passed object as a string.
static java.lang.String getFirstNCharactersWithTrailer(java.lang.String s, int chars)
           
static java.lang.String getFirstNLines(java.lang.String s, int lines)
          Returns the first n lines of the passed string
static java.lang.String getFirstNLinesWithTrailer(java.lang.String s, int lines)
           
static HtmlUtils getInstanceForFreemarker()
           
static java.lang.String getTextAsHtml(java.lang.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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

WBR

public static final java.lang.String WBR
See Also:
Constant Field Values

BSLASH

public static final java.lang.String BSLASH
See Also:
Constant Field Values
Method Detail

getAsPreformattedText

public static java.lang.String getAsPreformattedText(java.lang.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 java.lang.String getTextAsHtml(java.lang.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 java.lang.String getFirstNLines(java.lang.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 java.lang.String getFirstNLinesWithTrailer(java.lang.String s,
                                                         int lines)

getFirstNCharactersWithTrailer

public static java.lang.String getFirstNCharactersWithTrailer(@Nullable
                                                              java.lang.String s,
                                                              int chars)

appendUrls

public static java.lang.String appendUrls(java.lang.String url1,
                                          java.lang.String url2)

encodeUrl

public static java.lang.String encodeUrl(java.lang.String url)

addPrefixToLines

public static java.lang.String addPrefixToLines(java.lang.String prefix,
                                                java.lang.String input)

getInstanceForFreemarker

public static HtmlUtils getInstanceForFreemarker()


Copyright © 2011 Atlassian. All Rights Reserved.