Package i2p.susi.webmail.encoding
Class Encoding
java.lang.Object
i2p.susi.webmail.encoding.Encoding
- Direct Known Subclasses:
Base64,EightBit,HeaderLine,HTML,QuotedPrintable,SevenBit
Interface to encode/decode content transfer encodings like quoted-printable, base64 etc.
- Since:
- 0.9.33 changed from interface to abstract class
- Author:
- susi
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondecode(byte[] in) This implementation just calls decode(in, 0, in.length).decode(byte[] in, int offset, int length) This implementation just calls decode(in.content, in.offset, in.length).voidabstract voiddecode(InputStream in, Buffer out) This implementation just converts the string to a byte array and then calls decode(byte[]).abstract Stringencode(byte[] in) Encode a byte array to a ASCII or ISO-8859-1 String.voidencode(InputStream in, Writer out) Encode an input stream of bytes to a ASCII or ISO-8859-1 String.Encode a (UTF-8) String to a ASCII or ISO-8859-1 String.abstract StringgetName()
-
Field Details
-
_log
-
-
Constructor Details
-
Encoding
protected Encoding()
-
-
Method Details
-
getName
-
encode
Encode a byte array to a ASCII or ISO-8859-1 String. Output must be SMTP-safe: Line length of 998 or less, using SMTP-safe characters, followed by \r\n, and must not start with a '.' unless escaped by a 2nd dot. For some encodings, max line length is 76.- Parameters:
in-- Returns:
- Encoded string.
- Throws:
EncodingException
-
encode
Encode a (UTF-8) String to a ASCII or ISO-8859-1 String. Output must be SMTP-safe: Line length of 998 or less, using SMTP-safe characters, followed by \r\n, and must not start with a '.' unless escaped by a 2nd dot. For some encodings, max line length is 76. This implementation just converts the string to a byte array and then calls encode(byte[]). Most classes will not need to override.- Parameters:
str-- Throws:
EncodingException- Since:
- 0.9.33 implementation moved from subclasses
- See Also:
-
encode
Encode an input stream of bytes to a ASCII or ISO-8859-1 String. Output must be SMTP-safe: Line length of 998 or less, using SMTP-safe characters, followed by \r\n, and must not start with a '.' unless escaped by a 2nd dot. For some encodings, max line length is 76. This implementation just reads the whole stream into memory and then calls encode(byte[]). Subclasses should implement a more memory-efficient method if large inputs are expected.- Throws:
IOException- Since:
- 0.9.33
-
decode
This implementation just calls decode(in, 0, in.length). Most classes will not need to override.- Parameters:
in-- Throws:
DecodingException- Since:
- 0.9.33 implementation moved from subclasses
- See Also:
-
decode
- Parameters:
in-offset-length-- Returns:
- Output buffer containing decoded String.
- Throws:
DecodingException
-
decode
This implementation just converts the string to a byte array and then calls decode(byte[]). Most classes will not need to override.- Parameters:
str-- Returns:
- null if str is null
- Throws:
DecodingException- Since:
- 0.9.33 implementation moved from subclasses
- See Also:
-
decode
This implementation just calls decode(in.content, in.offset, in.length). Most classes will not need to override.- Parameters:
in-- Throws:
DecodingExceptionIOException- Since:
- 0.9.33 implementation moved from subclasses
- See Also:
-
decode
- Parameters:
in-- Throws:
DecodingExceptionIOException- Since:
- 0.9.34
- See Also:
-
decode
- Parameters:
in-- Throws:
DecodingExceptionIOException- Since:
- 0.9.34
- See Also:
-