org.sandev.basics.util
Class TextEncoder

java.lang.Object
  extended by org.sandev.basics.util.TextEncoder

public class TextEncoder
extends java.lang.Object

A utility class for encoding and decoding text, used to preserve text formatting. This is basically a thin wrapper for URLEncoder/Decoder but without any exceptions thrown.


Constructor Summary
TextEncoder()
           
 
Method Summary
static java.lang.String decode(java.lang.String prefix, java.lang.String text)
          A thin wrapper for URLDecoder.decode which does not throw.
static java.lang.String encode(java.lang.String prefix, java.lang.String text)
          A thin wrapper for URLEncoder.encode which does not throw.
static java.lang.String stripHref(java.lang.String text)
          Remove any href links in the text returning the result
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TextEncoder

public TextEncoder()
Method Detail

encode

public static java.lang.String encode(java.lang.String prefix,
                                      java.lang.String text)
A thin wrapper for URLEncoder.encode which does not throw. The prefix is plain text which is prepended to the returned encoded text. This allows the corresponding decode action to be able to toggle on the prefix as an indicator. To skip tagging, use the empty string.


decode

public static java.lang.String decode(java.lang.String prefix,
                                      java.lang.String text)
A thin wrapper for URLDecoder.decode which does not throw. The prefix is plain text which the encoded text must start with for decoding to be done. To decode without checking for a prefix, pass the empty string.


stripHref

public static java.lang.String stripHref(java.lang.String text)
Remove any href links in the text returning the result