public class Base64 extends Object
encode(byte[])
method and you'll get a
byte array result where all of the bytes are printable ASCII values. Pass that result
into decode(byte[])
and you'll get your original byte array.
Sincere thanks to Tom Daley for providing a sample encoder algorithm and a great explanation of how RFC-1521 is supposed to work.
Modifier and Type | Method and Description |
---|---|
static byte[] |
decode(byte[] data)
Decode from base 64.
|
static byte[] |
decode(byte[] data,
int offset,
int length)
Decode from base 64.
|
static byte[] |
encode(byte[] data)
Encode into base 64.
|
static byte[] |
encode(byte[] data,
int offset,
int length)
Encode into base 64.
|
static void |
main(String[] argv)
Command-line runner that encodes or decodes.
|
public static byte[] encode(byte[] data)
data
- The data to encode.public static byte[] encode(byte[] data, int offset, int length)
data
- The data to encode.offset
- Where to start looking for data to encode.length
- How much data to encode.public static byte[] decode(byte[] data)
data
- Base-64 encoded data to decode.public static byte[] decode(byte[] data, int offset, int length)
data
- Base-64 encoded data to decode.offset
- Where to start looking for data to decode.length
- How much data to decode.public static void main(String[] argv) throws IOException
argv
- Command-line arguments.IOException
Copyright © 1999–2017 Apache OODT. All rights reserved.