java.lang.Object
i2p.susi.webmail.encoding.Encoding
i2p.susi.webmail.encoding.Base64
Base64 encoding implementation.
Field Summary
Constructor Summary
ConstructorsMethod Summary
Modifier and TypeMethodDescriptionvoiddecode(InputStream in, Buffer bout) Decode base64 input into the buffer.private static bytedecodeByte(int c) Maps one base64 character to its 6-bit value.encode(byte[] in) Encode the bytes as base64.voidencode(InputStream in, Writer strBuf) More efficient than super.private static intencodeByte(int b) The base64 character for a 6-bit value.getName()Returns the name of this encoding.private static intreadIn(InputStream in) Reads the next byte that is not a space or a line break.Methods inherited from class Encoding
decode, decode, decode, decode, decode, encodeModifier and TypeMethodDescriptiondecode(byte[] in) Decode a byte array using default offset and length.decode(byte[] in, int offset, int length) Decode a portion of a byte array.Decode a buffer into another buffer.voidDecode a buffer into another buffer using the input stream.Decode a string.Encode a (UTF-8) String to a ASCII or ISO-8859-1 String.
Constructor Details
Base64
public Base64()Create a new Base64 encoder.
Method Details
getName
encode
Encode the bytes as base64.- Specified by:
encodein classEncoding- Parameters:
in- the byte array to encode- Returns:
- Base64-encoded String.
- Throws:
EncodingException- if encoding fails
encode
More efficient than super.- Overrides:
encodein classEncoding- Parameters:
in- the input stream to encodestrBuf- the writer to write encoded output to- Throws:
IOException- if reading from stream or writing fails- See Also:
encodeByte
private static int encodeByte(int b) The base64 character for a 6-bit value.- Parameters:
b- the 6-bit value to encode- Returns:
- Encoded single byte.
decodeByte
Maps one base64 character to its 6-bit value.- Parameters:
c- the character read- Returns:
- the value, 0 for the = padding character
- Throws:
IOException- if the input ended before a character
readIn
Reads the next byte that is not a space or a line break.- Parameters:
in- the stream to read- Returns:
- the byte, or -1 at the end of the stream
- Throws:
IOException- if the read fails
decode
Decode base64 input into the buffer.- Specified by:
decodein classEncoding- Parameters:
in- the input stream to read data frombout- the buffer to write decoded data to- Throws:
IOException- if reading from input stream fails- See Also: