Lines Matching defs:encoding

75  * the String into another charset and then do the transfer-encoding.
112 * an encoding that allows normal end of line conventions is appropriate.
114 * data, but will require an encoding that preserves CR and LF characters
116 * System property is set to <code>"true"</code>, such an encoding will
123 * specified in the <code>file.encoding</code> System property. Most
135 * encoding is assumed. Otherwise, unknown values cause a MessagingException
181 * what encoding to use. If it returns non-null, return that value.
184 * the bytes in its input stream are US-ASCII, then the encoding
186 * the encoding is "base64". If less than half of the bytes are
187 * non-US-ASCII, then the encoding is "quoted-printable".
190 * all the bytes of its input stream are US-ASCII, the encoding
192 * encoding is "base64".
196 * @return the encoding. This is either "7bit",
202 String encoding = null;
205 encoding = ((EncodingAware)ds).getEncoding();
206 if (encoding != null)
207 return encoding;
218 encoding = "7bit"; // all ASCII
222 encoding = "base64"; // charset isn't compatible with ASCII
224 encoding = "quoted-printable"; // mostly ASCII
227 encoding = "base64"; // mostly binary
241 return encoding;
296 String encoding = null;
300 * encoding. If this DataHandler was created using a DataSource,
330 encoding = "7bit"; // all ascii
333 encoding = "quoted-printable"; // mostly ascii
336 encoding = "base64"; // mostly binary
348 encoding = "7bit";
350 encoding = "base64";
353 return encoding;
365 * <code>"true"</code>, unknown encoding values are ignored and the
369 * @param encoding the encoding of the stream.
371 * @exception MessagingException if the encoding is unknown
373 public static InputStream decode(InputStream is, String encoding)
375 if (encoding.equalsIgnoreCase("base64"))
377 else if (encoding.equalsIgnoreCase("quoted-printable"))
379 else if (encoding.equalsIgnoreCase("uuencode") ||
380 encoding.equalsIgnoreCase("x-uuencode") ||
381 encoding.equalsIgnoreCase("x-uue"))
383 else if (encoding.equalsIgnoreCase("binary") ||
384 encoding.equalsIgnoreCase("7bit") ||
385 encoding.equalsIgnoreCase("8bit"))
389 throw new MessagingException("Unknown encoding: " + encoding);
401 * @param encoding the encoding of the stream.
403 * specified encoding.
404 * @exception MessagingException if the encoding is unknown
406 public static OutputStream encode(OutputStream os, String encoding)
408 if (encoding == null)
410 else if (encoding.equalsIgnoreCase("base64"))
412 else if (encoding.equalsIgnoreCase("quoted-printable"))
414 else if (encoding.equalsIgnoreCase("uuencode") ||
415 encoding.equalsIgnoreCase("x-uuencode") ||
416 encoding.equalsIgnoreCase("x-uue"))
418 else if (encoding.equalsIgnoreCase("binary") ||
419 encoding.equalsIgnoreCase("7bit") ||
420 encoding.equalsIgnoreCase("8bit"))
423 throw new MessagingException("Unknown encoding: " +encoding);
432 * encoding and is included in the encoded output.
435 * @param encoding the encoding of the stream.
439 * specified encoding.
443 public static OutputStream encode(OutputStream os, String encoding,
446 if (encoding == null)
448 else if (encoding.equalsIgnoreCase("base64"))
450 else if (encoding.equalsIgnoreCase("quoted-printable"))
452 else if (encoding.equalsIgnoreCase("uuencode") ||
453 encoding.equalsIgnoreCase("x-uuencode") ||
454 encoding.equalsIgnoreCase("x-uue"))
456 else if (encoding.equalsIgnoreCase("binary") ||
457 encoding.equalsIgnoreCase("7bit") ||
458 encoding.equalsIgnoreCase("8bit"))
461 throw new MessagingException("Unknown encoding: " +encoding);
473 * Q encoding. The resulting bytes are then returned as a Unicode
486 * // characters, we can skip the encoding part
489 * // encoding failure
498 * @exception UnsupportedEncodingException if the encoding fails
513 * charset, then transfer-encoded using either the B or Q encoding.
523 * @param encoding the encoding to be used. Currently supported
525 * the "Q" encoding is used if most of characters to be
526 * encoded are in the ASCII charset, otherwise "B" encoding
533 String encoding)
535 return encodeWord(text, charset, encoding, false);
670 * Q encoding. The resulting bytes are then returned as a Unicode
680 * @exception UnsupportedEncodingException if the encoding fails
695 * charset, then transfer-encoded using either the B or Q encoding.
701 * @param encoding the encoding to be used. Currently supported
703 * the "Q" encoding is used if most of characters to be
704 * encoded are in the ASCII charset, otherwise "B" encoding
707 * @exception UnsupportedEncodingException if the encoding fails
710 String encoding)
712 return encodeWord(word, charset, encoding, true);
719 * "Q" encoding defined in RFC 2047 has more restrictions when
720 * encoding "word" tokens. (Sigh)
723 String encoding, boolean encodingWord)
740 // If no transfer-encoding is specified, figure one out.
741 if (encoding == null) {
743 encoding = "Q";
745 encoding = "B";
749 if (encoding.equalsIgnoreCase("B"))
751 else if (encoding.equalsIgnoreCase("Q"))
755 "Unknown transfer encoding: " + encoding);
763 "=?" + charset + "?" + encoding + "?", // prefix
778 if (b64) // "B" encoding
800 if (b64) // "B" encoding
802 else // "Q" encoding
805 try { // do the encoding
858 // get encoding
862 "encoded word does not include encoding: " + eword);
863 String encoding = eword.substring(start, pos);
888 if (encoding.equalsIgnoreCase("B"))
890 else if (encoding.equalsIgnoreCase("Q"))
894 "unknown encoding: " + encoding);
956 // find next '?' after that - end of encoding
1296 defaultJavaCharset = System.getProperty("file.encoding",