public class B64Code extends Object
Does not insert or interpret whitespace as described in RFC 1521. If you require this you must pre/post process your data.
Note that in a web context the usual case is to not want linebreaks or other white space in the encoded output.
Constructor and Description |
---|
B64Code() |
Modifier and Type | Method and Description |
---|---|
static byte[] |
decode(char[] b)
Fast Base 64 decode as described in RFC 1421.
|
static String |
decode(String s)
Base 64 decode as described in RFC 1421.
|
static String |
decode(String s,
String charEncoding)
Base 64 decode as described in RFC 1421.
|
static char[] |
encode(byte[] b)
Fast Base 64 encode as described in RFC 1421.
|
static String |
encode(String s)
Base 64 encode as described in RFC 1421.
|
static String |
encode(String s,
String charEncoding)
Base 64 encode as described in RFC 1421.
|
public static String encode(String s)
Does not insert whitespace as described in RFC 1521.
s
- String to encode.public static String encode(String s, String charEncoding) throws UnsupportedEncodingException
Does not insert whitespace as described in RFC 1521.
s
- String to encode.charEncoding
- String representing the name of
the character encoding of the provided input String.UnsupportedEncodingException
public static char[] encode(byte[] b)
Does not insert whitespace as described in RFC 1521.
Avoids creating extra copies of the input/output.
b
- byte array to encode.public static String decode(String s)
Does not attempt to cope with extra whitespace as described in RFC 1521.
s
- String to decodepublic static String decode(String s, String charEncoding) throws UnsupportedEncodingException
Does not attempt to cope with extra whitespace as described in RFC 1521.
s
- String to decodecharEncoding
- String representing the character encoding
used to map the decoded bytes into a String.UnsupportedEncodingException
public static byte[] decode(char[] b)
Does not attempt to cope with extra whitespace as described in RFC 1521.
Avoids creating extra copies of the input/output.
Note this code has been flattened for performance.
b
- char array to decode.IllegalArgumentException
- if the input is not a valid
B64 encoding.Copyright © 2016. All Rights Reserved.