Package ghidra.util.html
Class HtmlLineSplitter
java.lang.Object
ghidra.util.html.HtmlLineSplitter
Splits into lines a given String that is meant to be rendered as HTML.
Really, this class exists simply to remove hundreds of lines of code from
HTMLUtilities
, which is what this code supports. The methods in here could easily
be in StringUtils
, but to keep dependencies low on code that has such a specific use,
it lives here, with a name that implies you shouldn't use it unless you are working with
HTML.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Used when trying to split on word boundaries; the value past which to give up -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionSplits the given line into multiple lines based upon the given max length.Splits the given line into multiple lines based upon the given max length.
-
Field Details
-
MAX_WORD_LENGTH
public static final int MAX_WORD_LENGTHUsed when trying to split on word boundaries; the value past which to give up- See Also:
-
-
Constructor Details
-
HtmlLineSplitter
public HtmlLineSplitter()
-
-
Method Details
-
split
Splits the given line into multiple lines based upon the given max length. This method will first split on each newline and then wrap each of the lines returned from that split.The wrapping routine will attempt to wrap at word boundaries.
This method does not retain leading whitespace.
- Parameters:
text
- the text to wrapmaxLineLength
- the max desired length of each output line; 0 or less signals not to wrap the line based upon length- Returns:
- the new lines
- See Also:
-
split
Splits the given line into multiple lines based upon the given max length. This method will first split on each newline and then wrap each of the lines returned from that split.The wrapping routine will attempt to wrap at word boundaries.
- Parameters:
text
- the text to wrapmaxLineLength
- the max desired length of each output line; 0 or less signals not to wrap the line based upon lengthretainSpacing
- true signals to keep whitespace on line breaks; false discards leading whitespace- Returns:
- the new lines
- See Also:
-