|
JSecurity | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jsecurity.codec.CodecSupport
public abstract class CodecSupport
| Field Summary | |
|---|---|
static String |
PREFERRED_ENCODING
JSecurity's default preferred Character encoding, equal to UTF-8. |
| Constructor Summary | |
|---|---|
CodecSupport()
|
|
| Method Summary | |
|---|---|
protected byte[] |
objectToBytes(Object o)
Default implementation throws a CodecException immediately since it can't infer how to convert the Object to a byte array. |
protected String |
objectToString(Object o)
Default implementation merely returns objectArgument.toString(). |
static byte[] |
toBytes(char[] chars)
Converts the specified character array to a byte array using the JSecurity's preferred encoding (UTF-8). |
static byte[] |
toBytes(char[] chars,
String encoding)
Converts the specified character array into a byte array using the specified character encoding. |
protected byte[] |
toBytes(Object o)
Converts the specified Object into a byte array. |
static byte[] |
toBytes(String source)
Converts the specified source argument to a byte array with JSecurity's PREFERRED_ENCODING. |
static byte[] |
toBytes(String source,
String encoding)
Converts the specified source to a byte array via the specified encoding, throwing a CodecException if the encoding fails. |
static char[] |
toChars(byte[] bytes)
Returns the specified byte array as a character array using JSecurity's PREFERRED_ENCODING. |
static char[] |
toChars(byte[] bytes,
String encoding)
Converts the specified byte array to a character array using the specified character encoding. |
static String |
toString(byte[] bytes)
Converts the specified byte array to a string using JSecurity's PREFERRED_ENCODING. |
static String |
toString(byte[] bytes,
String encoding)
Converts the specified byte array to a String using the specified character encoding. |
protected String |
toString(Object o)
Converts the specified Object into a String. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String PREFERRED_ENCODING
UTF-8.
| Constructor Detail |
|---|
public CodecSupport()
| Method Detail |
|---|
public static byte[] toBytes(char[] chars)
toBytes(String,String) method with a
a wrapping String and PREFERRED_ENCODING, i.e.
toBytes( new String(chars), PREFERRED_ENCODING );
chars - the character array to be converted to a byte array.
public static byte[] toBytes(char[] chars,
String encoding)
throws CodecException
toBytes(String,String) method with a
a wrapping String and the specified encoding, i.e.
toBytes( new String(chars), encoding );
chars - the character array to be converted to a byte arrayencoding - the character encoding to use to when converting to bytes.
CodecException - if the JVM does not support the specified encoding.public static byte[] toBytes(String source)
PREFERRED_ENCODING.
source - the string to convert to a byte array.
PREFERRED_ENCODING.
public static byte[] toBytes(String source,
String encoding)
throws CodecException
CodecException if the encoding fails.
source - the source string to convert to a byte array.encoding - the encoding to use to use.
CodecException - if the JVM does not support the specified encoding.public static String toString(byte[] bytes)
PREFERRED_ENCODING.
bytes - the byte array to turn into a String.
PREFERRED_ENCODING).
public static String toString(byte[] bytes,
String encoding)
throws CodecException
bytes - the byte array to convert to a Stringencoding - the character encoding used to encode the String.
CodecException - if the JVM does not support the specified encoding.public static char[] toChars(byte[] bytes)
PREFERRED_ENCODING.
bytes - the byte array to convert to a char array
PREFERRED_ENCODING).
public static char[] toChars(byte[] bytes,
String encoding)
throws CodecException
bytes - the byte array to convert to a Stringencoding - the character encoding used to encode the bytes.
CodecException - if the JVM does not support the specified encoding.protected byte[] toBytes(Object o)
If the argument is a byte[], char[], or String it will be converted automatically and returned.
If the argument is anything other than these three types, it is passed to the
objectToBytes method which must be overridden by subclasses.
o - the Object to convert into a byte array
protected String toString(Object o)
If the argument is a byte[], char[], or String it will be converted automatically and returned.
If the argument is anything other than these three types, it is passed to the
objectToString method which must be overridden by subclasses.
o - the Object to convert into a byte array
protected byte[] objectToBytes(Object o)
toBytes(Object) JavaDoc) are to be converted to a byte array.
o - the Object to convert to a byte array.
protected String objectToString(Object o)
objectArgument.toString(). Subclasses can override this
method for different mechanisms of converting an object to a String.
o - the Object to convert to a byte array.
|
JSecurity | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||