Class Base64Encoder
- java.lang.Object
-
- org.simpleframework.common.encode.Base64Encoder
-
public class Base64Encoder extends java.lang.Object
TheBase64Encoder
is used to encode and decode base64 content. The implementation used here provides a reasonably fast memory efficient encoder for use with input and output streams. It is possible to achieve higher performance, however, ease of use and convenience are the priorities with this implementation. This can only decode complete blocks.- See Also:
Base64OutputStream
,Base64InputStream
-
-
Constructor Summary
Constructors Constructor Description Base64Encoder()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static byte[]
decode(char[] text)
This is used to decode the provide base64 data back in to an array of binary data.static byte[]
decode(char[] text, int off, int len)
This is used to decode the provide base64 data back in to an array of binary data.static char[]
encode(byte[] buf)
This method is used to encode the specified byte array of binary data in to base64 data.static char[]
encode(byte[] buf, int off, int len)
This method is used to encode the specified byte array of binary data in to base64 data.
-
-
-
Method Detail
-
encode
public static char[] encode(byte[] buf)
This method is used to encode the specified byte array of binary data in to base64 data. The block is complete and must be decoded as a complete block.- Parameters:
buf
- this is the binary data to be encoded- Returns:
- this is the base64 encoded value of the data
-
encode
public static char[] encode(byte[] buf, int off, int len)
This method is used to encode the specified byte array of binary data in to base64 data. The block is complete and must be decoded as a complete block.- Parameters:
buf
- this is the binary data to be encodedoff
- this is the offset to read the binary data fromlen
- this is the length of data to encode from the array- Returns:
- this is the base64 encoded value of the data
-
decode
public static byte[] decode(char[] text)
This is used to decode the provide base64 data back in to an array of binary data. The data provided here must be a full block of base 64 data in order to be decoded.- Parameters:
text
- this is the base64 text to be decoded- Returns:
- this returns the resulting byte array
-
decode
public static byte[] decode(char[] text, int off, int len)
This is used to decode the provide base64 data back in to an array of binary data. The data provided here must be a full block of base 64 data in order to be decoded.- Parameters:
text
- this is the base64 text to be decodedoff
- this is the offset to read the text data fromlen
- this is the length of data to decode from the text- Returns:
- this returns the resulting byte array
-
-