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
           
 
Constructor Summary
HtmlUtils()
           
 
Method Summary
 java.lang.String addPrefixToLines(java.lang.String prefix, java.lang.String input)
           
 java.lang.String appendUrls(java.lang.String url1, java.lang.String url2)
           
 java.lang.String encodeUrl(java.lang.String url)
           
 java.lang.String getAsPreformattedText(java.lang.Object o)
          Escapes the passed object as a string.
 java.lang.String getFirstNCharactersWithTrailer(java.lang.String s, int chars)
           
 java.lang.String getFirstNLines(java.lang.String s, int lines)
          Returns the first n lines of the passed string
 java.lang.String getFirstNLinesWithTrailer(java.lang.String s, int lines)
           
 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
Constructor Detail

HtmlUtils

public HtmlUtils()
Method Detail

getAsPreformattedText

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

getFirstNCharactersWithTrailer

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

appendUrls

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

encodeUrl

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

addPrefixToLines

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


Copyright © 2010 Atlassian. All Rights Reserved.