Package org.apache.cxf.common.util
Class Base64Utility
- java.lang.Object
- 
- org.apache.cxf.common.util.Base64Utility
 
- 
 public final class Base64Utility extends Object This class converts to/from base64. The alternative conversions include: encode: byte[] into String byte[] into char[] byte[] into OutStream byte[] into Writer decode: char[] into byte[] String into byte[] char[] into OutStream String into OutStream
- 
- 
Method SummaryAll Methods Static Methods Concrete Methods Modifier and Type Method Description static voiddecode(char[] id, int o, int l, OutputStream ostream)static byte[]decode(String id)static byte[]decode(String id, boolean urlSafe)static voiddecode(String id, OutputStream ostream)static byte[]decodeChunk(char[] id, int o, int l)Thedecode_chunkroutine decodes a chunk of data into its native encoding.static Stringencode(byte[] id)static Stringencode(byte[] id, boolean urlSafe)static voidencode(byte[] id, int o, int l, Writer writer)static voidencodeAndStream(byte[] id, int o, int l, boolean urlSafe, OutputStream os)static voidencodeAndStream(byte[] id, int o, int l, OutputStream os)static char[]encodeChunk(byte[] id, int o, int l)static char[]encodeChunk(byte[] id, int o, int l, boolean urlSafe)static voidencodeChunk(byte[] id, int o, int l, OutputStream ostream)static booleanisValidBase64(int ch)
 
- 
- 
- 
Method Detail- 
decodeChunkpublic static byte[] decodeChunk(char[] id, int o, int l) throws Base64ExceptionThedecode_chunkroutine decodes a chunk of data into its native encoding. base64 encodes each 3 octets of data into 4 characters from a limited 64 character set. The 3 octets are joined to form 24 bits which are then split into 4 x 6bit values. Each 6 bit value is then used as an index into the 64 character table of base64 chars. If the total data length is not a 3 octet multiple the '=' char is used as padding for the final 4 char group, either 1 octet + '==' or 2 octets + '='.- Parameters:
- id- The input data to be processed
- o- The offset from which to begin processing
- l- The length (bound) at which processing is to end
- Returns:
- The decoded data
- Throws:
- Base64Exception- Thrown is processing fails due to formatting exceptions in the encoded data
 
 - 
decodepublic static byte[] decode(String id) throws Base64Exception - Throws:
- Base64Exception
 
 - 
decodepublic static byte[] decode(String id, boolean urlSafe) throws Base64Exception - Throws:
- Base64Exception
 
 - 
decodepublic static void decode(char[] id, int o, int l, OutputStream ostream) throws Base64Exception- Throws:
- Base64Exception
 
 - 
decodepublic static void decode(String id, OutputStream ostream) throws Base64Exception - Throws:
- Base64Exception
 
 - 
encodepublic static String encode(byte[] id) 
 - 
encodepublic static String encode(byte[] id, boolean urlSafe) 
 - 
encodeChunkpublic static char[] encodeChunk(byte[] id, int o, int l)
 - 
encodeChunkpublic static char[] encodeChunk(byte[] id, int o, int l, boolean urlSafe)
 - 
encodeAndStreampublic static void encodeAndStream(byte[] id, int o, int l, OutputStream os) throws IOException- Throws:
- IOException
 
 - 
encodeAndStreampublic static void encodeAndStream(byte[] id, int o, int l, boolean urlSafe, OutputStream os) throws IOException- Throws:
- IOException
 
 - 
encodeChunkpublic static void encodeChunk(byte[] id, int o, int l, OutputStream ostream) throws Base64Exception- Throws:
- Base64Exception
 
 - 
encodepublic static void encode(byte[] id, int o, int l, Writer writer) throws Base64Exception- Throws:
- Base64Exception
 
 - 
isValidBase64public static boolean isValidBase64(int ch) 
 
- 
 
-