org.buglet.util
Class TextFormatter
java.lang.Object
|
+--org.buglet.util.TextFormatter
- public class TextFormatter
- extends java.lang.Object
This class is used for formatting text for HTML use, limiting to some number of characters.
Field Summary |
(package private) java.lang.String |
buf
This is the value to be formatted |
static boolean |
debug
Indicates whether debugging info should be printed or not. |
(package private) org.apache.log4j.Category |
log
|
Constructor Summary |
TextFormatter(java.lang.String theString)
Constructor, sets the buffer to the value |
Method Summary |
static void |
main(java.lang.String[] args)
main method for testing |
java.lang.StringBuffer |
munge(int width,
java.lang.String separator)
Returns the String as a string with newlines at least every width characters. |
java.lang.StringBuffer |
prettyHtml()
Converts the buffer to HTML, with lines 80 characters long. |
java.lang.StringBuffer |
prettyHtml(int width)
Retruns the formatted String using the given width. |
java.lang.StringBuffer |
prettyText(int width)
returns text based output |
static java.lang.String |
wrap(java.lang.String val)
|
java.lang.String |
wrapped(int width)
|
Methods inherited from class java.lang.Object |
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
log
org.apache.log4j.Category log
buf
java.lang.String buf
- This is the value to be formatted
debug
public static final boolean debug
- Indicates whether debugging info should be printed or not.
TextFormatter
public TextFormatter(java.lang.String theString)
- Constructor, sets the buffer to the value
- Parameters:
theString
-
prettyHtml
public java.lang.StringBuffer prettyHtml()
- Converts the buffer to HTML, with lines 80 characters long.
wrapped
public java.lang.String wrapped(int width)
wrap
public static java.lang.String wrap(java.lang.String val)
main
public static void main(java.lang.String[] args)
- main method for testing
- Parameters:
args
-
munge
public java.lang.StringBuffer munge(int width,
java.lang.String separator)
- Returns the String as a string with newlines at least every width characters. This function obeys String boundries.
- Parameters:
width
-
prettyHtml
public java.lang.StringBuffer prettyHtml(int width)
- Retruns the formatted String using the given width.
- Parameters:
width
-
prettyText
public java.lang.StringBuffer prettyText(int width)
- returns text based output
Copyright © 2001 58k.com Inc. All Rights Reserved