|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectbiz.source_code.base64Coder.Base64Coder
public class Base64Coder
A Base64 encoder/decoder.
This class is used to encode and decode data in Base64 format as described in RFC 1521.
Project home page: www.source-code.biz/base64coder/java
Author: Christian d'Heureuse, Inventec Informatik AG, Zurich,
Switzerland
Multi-licensed: EPL / LGPL / AL / BSD.
Field Summary | |
---|---|
private static char[] |
map1
Mapping table from 6-bit nibbles to Base64 characters. |
private static byte[] |
map2
Mapping table from Base64 characters to 6-bit nibbles. |
private static String |
systemLineSeparator
The line separator string of the operating system. |
Constructor Summary | |
---|---|
private |
Base64Coder()
Dummy constructor. |
Method Summary | |
---|---|
static byte[] |
decode(char[] in)
Decodes a byte array from Base64 format. |
static byte[] |
decode(char[] in,
int iOff,
int iLenIn)
Decodes a byte array from Base64 format. |
static byte[] |
decode(String s)
Decodes a byte array from Base64 format. |
static byte[] |
decodeLines(String s)
Decodes a byte array from Base64 format and ignores line separators, tabs and blanks. |
static String |
decodeString(String s)
Decodes a string from Base64 format. |
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 char[] |
encode(byte[] in,
int iOff,
int iLen)
Encodes a byte array into Base64 format. |
static String |
encodeLines(byte[] in)
Encodes a byte array into Base 64 format and breaks the output into lines of 76 characters. |
static String |
encodeLines(byte[] in,
int iOff,
int iLen,
int lineLen,
String lineSeparator)
Encodes a byte array into Base 64 format and breaks the output into lines. |
static String |
encodeString(String s)
Encodes a string into Base64 format. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final String systemLineSeparator
private static char[] map1
private static byte[] map2
Constructor Detail |
---|
private Base64Coder()
Method Detail |
---|
public static byte[] decode(char[] in)
in
- A character array containing the Base64 encoded data.
IllegalArgumentException
- If the input is not valid Base64
encoded data.public static byte[] decode(char[] in, int iOff, int iLenIn)
in
- A character array containing the Base64 encoded data.iOff
- Offset of the first character in in
to
be processed.iLenIn
- Number of characters to process in in
,
starting at iOff
.
IllegalArgumentException
- If the input is not valid Base64
encoded data.public static byte[] decode(String s)
s
- A Base64 String to be decoded.
IllegalArgumentException
- If the input is not valid Base64
encoded data.public static byte[] decodeLines(String s)
sun.misc.BASE64Decoder.decodeBuffer(String)
.
s
- A Base64 String to be decoded.
IllegalArgumentException
- If the input is not valid Base64
encoded data.public static String decodeString(String s)
s
- A Base64 String to be decoded.
IllegalArgumentException
- If the input is not valid Base64
encoded data.public static char[] encode(byte[] in)
in
- An array containing the data bytes to be encoded.
public static char[] encode(byte[] in, int iLen)
in
- An array containing the data bytes to be encoded.iLen
- Number of bytes to process in in
.
public static char[] encode(byte[] in, int iOff, int iLen)
in
- An array containing the data bytes to be encoded.iOff
- Offset of the first byte in in
to be
processed.iLen
- Number of bytes to process in in
,
starting at iOff
.
public static String encodeLines(byte[] in)
sun.misc.BASE64Encoder.encodeBuffer(byte[])
.
in
- An array containing the data bytes to be encoded.
public static String encodeLines(byte[] in, int iOff, int iLen, int lineLen, String lineSeparator)
in
- An array containing the data bytes to be encoded.iOff
- Offset of the first byte in in
to be
processed.iLen
- Number of bytes to be processed in in
,
starting at iOff
.lineLen
- Line length for the output data. Should be a
multiple of 4.lineSeparator
- The line separator to be used to separate
the output lines.
public static String encodeString(String s)
s
- A String to be encoded.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |