public class Encode extends Object
Encode encoder = new Encode("ESCAPE_XML");
System.out.println( encoder.decode( encoder.encode("& \" < >") ) );
| Constructor and Description |
|---|
Encode(String encoding)
Created a encode instance of a certain type of encoding.
|
| Modifier and Type | Method and Description |
|---|---|
String |
decode(String toDecode)
This function will decode a given string to it's decoded variant
|
static String |
decode(String encoding,
String toDecode)
This function will decode a given string to it's decoded variant.
|
byte[] |
decodeBytes(String toDecode) |
static byte[] |
decodeBytes(String encoding,
String toDecode) |
String |
encode(byte[] bytes)
Encodes a byte array.
|
String |
encode(String toEncode)
This function will encode a given string to it's encoded variant.
|
static String |
encode(String encoding,
byte[] bytes) |
static String |
encode(String encoding,
String toEncode)
This function will encode a given string to it's encoded
variant.
|
String |
getEncoding()
Returns the encoding
|
Transformer |
getTransformer() |
boolean |
isByteToCharEncoder()
Checks if the transformations makes from byte[] String.
|
boolean |
isCharEncoder()
Checks if the transformation is between two Strings.
|
static boolean |
isEncoding(String e)
Checks if a certain string represents a known transformation.
|
static void |
main(String[] argv)
Invocation of the class from the commandline for testing.
|
static Set<String> |
possibleEncodings()
All the currently known encodings.
|
static void |
register(String clazz)
Add new transformation types.
|
public Encode(String encoding)
encoding - a string that describes which encoding should be used.public Transformer getTransformer()
public static void register(String clazz)
clazz - a class name.public static String encode(String encoding, String toEncode)
encoding - a string that describes which encoding should be used.toEncode - a string which is the value which should be encoded.
This can also be a byte[].public static String decode(String encoding, String toDecode)
encoding - a string that describes which decoding should be used.toDecode - a string which is the value which should be encoded.encode(java.lang.String, java.lang.String)public String encode(String toEncode)
toEncode - A string which is the value which should be encoded.
If the transformer does transform bytes, then first getBytes is done on the String.public String encode(byte[] bytes)
public String decode(String toDecode)
toDecode - a string which is the value which should be encoded.public byte[] decodeBytes(String toDecode)
public static Set<String> possibleEncodings()
public static boolean isEncoding(String e)
public boolean isCharEncoder()
public boolean isByteToCharEncoder()
public String getEncoding()
public static void main(String[] argv)
MMBase 1.9-SNAPSHOT - ${javadoctimestamp}