org.xwiki.rendering.parser.xwiki10.util
Class CleanUtil

java.lang.Object
  extended by org.xwiki.rendering.parser.xwiki10.util.CleanUtil

public final class CleanUtil
extends java.lang.Object

Contains syntax cleaning helpers.

Since:
1.8M1
Version:
$Id: CleanUtil.java 21359 2009-06-19 16:35:08Z tmortagne $

Method Summary
static java.lang.String cleanSpacesAndNewLines(java.lang.String content)
          Replace all spaces/new line groupes by one space.
static java.lang.String convertEscape(java.lang.String content)
           
static java.lang.String extractVelocity(java.lang.CharSequence content, FilterContext filterContext)
           
static java.lang.String extractVelocity(java.lang.CharSequence content, FilterContext filterContext, boolean protect, boolean inline)
           
static java.lang.String removeLeadingNewLines(java.lang.String content)
          Remove all the first new lines.
static java.lang.String removeLeadingNewLines(java.lang.String content, int nb, boolean replaceWithSpace)
          Remove first new lines if there is more than 0 and less or equals to the provided number.
static java.lang.String removeTrailingNewLines(java.lang.String content)
          Remove all the last new lines.
static java.lang.String removeTrailingNewLines(java.lang.String content, int nb, boolean replaceWithSpace)
          Remove last new lines if there is more than 0 and less or equals to the provided number.
static java.lang.String setLeadingNewLines(java.lang.String content, int nb)
          Check the provided string contains enough new lines at the beginning and add the need ones.
static void setTrailingNewLines(java.lang.StringBuffer content, int nb)
          Check the provided string contains enough new lines at the end and add the need ones.
static java.lang.String setTrailingNewLines(java.lang.String content, int nb)
          Check the provided string contains enough new lines at the end and add the need ones.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

cleanSpacesAndNewLines

public static java.lang.String cleanSpacesAndNewLines(java.lang.String content)
Replace all spaces/new line groupes by one space.

Parameters:
content - the content to convert.
Returns:
the converted string.

removeLeadingNewLines

public static java.lang.String removeLeadingNewLines(java.lang.String content,
                                                     int nb,
                                                     boolean replaceWithSpace)
Remove first new lines if there is more than 0 and less or equals to the provided number.

Parameters:
content - the content to convert.
nb - the number of new lines to match.
replaceWithSpace - indicate if the removed new lines are replaced with a white space.
Returns:
the converted string.

removeTrailingNewLines

public static java.lang.String removeTrailingNewLines(java.lang.String content,
                                                      int nb,
                                                      boolean replaceWithSpace)
Remove last new lines if there is more than 0 and less or equals to the provided number.

Parameters:
content - the content to convert.
nb - the number of new lines to match.
replaceWithSpace - indicate if the removed new lines are replaced with a white space.
Returns:
the converted string.

setLeadingNewLines

public static java.lang.String setLeadingNewLines(java.lang.String content,
                                                  int nb)
Check the provided string contains enough new lines at the beginning and add the need ones.

Parameters:
content - the content to convert.
nb - the number of new lines the string need to contains at the beginning.
Returns:
the converted string.

setTrailingNewLines

public static java.lang.String setTrailingNewLines(java.lang.String content,
                                                   int nb)
Check the provided string contains enough new lines at the end and add the need ones.

Parameters:
content - the content to convert.
nb - the number of new lines the string need to contains at the end.
Returns:
the converted string.

setTrailingNewLines

public static void setTrailingNewLines(java.lang.StringBuffer content,
                                       int nb)
Check the provided string contains enough new lines at the end and add the need ones.

Parameters:
content - the content to convert.
nb - the number of new lines the string need to contains at the end.

removeLeadingNewLines

public static java.lang.String removeLeadingNewLines(java.lang.String content)
Remove all the first new lines.

Parameters:
content - the content to convert.
Returns:
the converted string.

removeTrailingNewLines

public static java.lang.String removeTrailingNewLines(java.lang.String content)
Remove all the last new lines.

Parameters:
content - the content to convert.
Returns:
the converted string.

convertEscape

public static java.lang.String convertEscape(java.lang.String content)
Parameters:
content - the content to convert.
Returns:
the converted string.

extractVelocity

public static java.lang.String extractVelocity(java.lang.CharSequence content,
                                               FilterContext filterContext)

extractVelocity

public static java.lang.String extractVelocity(java.lang.CharSequence content,
                                               FilterContext filterContext,
                                               boolean protect,
                                               boolean inline)


Copyright © 2004-2011 XWiki. All Rights Reserved.