Package org.nuiton.jaxx.runtime
Class Base64Coder
- java.lang.Object
-
- org.nuiton.jaxx.runtime.Base64Coder
-
public class Base64Coder extends Object
FIXME Use the jre one. A Base64 Encoder/Decoder. This class is used to encode and decode data in Base64 format as described in RFC 1521. This is "Open Source" software and released under the GNU/LGPL license.
It is provided "as is" without warranty of any kind.
Copyright 2003: Christian d'Heureuse, Inventec Informatik AG, Switzerland.
Home page: www.source-code.biz
Version history:
2003-07-22 Christian d'Heureuse (chdh): Module created.
2005-08-11 chdh: Lincense changed from GPL to LGPL.
2006-11-21 chdh:
Method encode(String) renamed to encodeString(String).
Method decode(String) renamed to decodeString(String).
New method encode(byte[],int) added.
New method decode(String) added.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static byte[]decode(char[] in)Decodes a byte array from Base64 format.static byte[]decode(String s)Decodes a byte array from Base64 format.static StringdecodeString(String s)Decodes a string from Base64 format.static Objectdeserialize(String s, boolean gzip)Read the object from Base64 string.static char[]encode(byte[] in)Encodes a byte array into Base64 format.static char[]encode(byte[] in, int iLen)Encodes a byte array into Base64 format.static StringencodeString(String s)Encodes a string into Base64 format.static Stringserialize(Object o, boolean gzip)Write the object to a Base64 string.
-
-
-
Method Detail
-
deserialize
public static Object deserialize(String s, boolean gzip) throws IOException, ClassNotFoundException
Read the object from Base64 string.- Parameters:
s- the string representation of serialized object.gzip- if gzip stream- Returns:
- the deserialize object
- Throws:
IOException- if any io pbClassNotFoundException- if class not found ?
-
serialize
public static String serialize(Object o, boolean gzip) throws IOException
Write the object to a Base64 string.- Parameters:
o- the object to serializegzip- if gzip stream- Returns:
- the string representation
- Throws:
IOException- if any io pb
-
encodeString
public static String encodeString(String s)
Encodes a string into Base64 format. No blanks or line breaks are inserted.- Parameters:
s- a String to be encoded.- Returns:
- A String with the Base64 encoded data.
-
encode
public static char[] encode(byte[] in)
Encodes a byte array into Base64 format. No blanks or line breaks are inserted.- Parameters:
in- an array containing the data bytes to be encoded.- Returns:
- A character array with the Base64 encoded data.
-
encode
public static char[] encode(byte[] in, int iLen)Encodes a byte array into Base64 format. No blanks or line breaks are inserted.- Parameters:
in- an array containing the data bytes to be encoded.iLen- number of bytes to process inin.- Returns:
- A character array with the Base64 encoded data.
-
decodeString
public static String decodeString(String s)
Decodes a string from Base64 format.- Parameters:
s- a Base64 String to be decoded.- Returns:
- A String containing the decoded data.
- Throws:
IllegalArgumentException- if the input is not valid Base64 encoded data.
-
decode
public static byte[] decode(String s)
Decodes a byte array from Base64 format.- Parameters:
s- a Base64 String to be decoded.- Returns:
- An array containing the decoded data bytes.
- Throws:
IllegalArgumentException- if the input is not valid Base64 encoded data.
-
decode
public static byte[] decode(char[] in)
Decodes a byte array from Base64 format. No blanks or line breaks are allowed within the Base64 encoded data.- Parameters:
in- a character array containing the Base64 encoded data.- Returns:
- An array containing the decoded data bytes.
- Throws:
IllegalArgumentException- if the input is not valid Base64 encoded data.
-
-