Decode the given input stream. The Input stream returned is the decoded input stream. All the encodings defined in RFC 2045 are supported here. They include "base64", "quoted-printable", "7bit", "8bit", and "binary". In addition, "uuencode" is also supported. In the current implementation, if t
(InputStream is, String encoding)
| 363 | * @exception MessagingException if the encoding is unknown |
| 364 | */ |
| 365 | public static InputStream decode(InputStream is, String encoding) |
| 366 | throws MessagingException { |
| 367 | if (encoding.equalsIgnoreCase("base64")) |
| 368 | return new BASE64DecoderStream(is); |
| 369 | else if (encoding.equalsIgnoreCase("quoted-printable")) |
| 370 | return new QPDecoderStream(is); |
| 371 | else if (encoding.equalsIgnoreCase("uuencode") || |
| 372 | encoding.equalsIgnoreCase("x-uuencode") || |
| 373 | encoding.equalsIgnoreCase("x-uue")) |
| 374 | return new UUDecoderStream(is); |
| 375 | else if (encoding.equalsIgnoreCase("binary") || |
| 376 | encoding.equalsIgnoreCase("7bit") || |
| 377 | encoding.equalsIgnoreCase("8bit")) |
| 378 | return is; |
| 379 | else { |
| 380 | if (!ignoreUnknownEncoding) |
| 381 | throw new MessagingException("Unknown encoding: " + encoding); |
| 382 | return is; |
| 383 | } |
| 384 | } |
| 385 | |
| 386 | /** |
| 387 | * Wrap an encoder around the given output stream. |
no outgoing calls
no test coverage detected