Lines Matching refs:is

37  * only if the new code is made subject to such option by the copyright
51 * This is a utility class that provides various MIME related
61 * methods. A brief description on handling such headers is given below: <p>
69 * In Java, Strings contain (16 bit) Unicode characters. ASCII is a
71 * that contains only ASCII characters is already mail-safe. If the
73 * additional complexity in this step is that since Unicode is not
105 * If the <code>mail.mime.decodetext.strict</code> System property is
107 * illegal encoded words. The default is true. <p>
112 * an encoding that allows normal end of line conventions is appropriate.
116 * System property is set to <code>"true"</code>, such an encoding will
117 * be used when necessary. The default is false. <p>
122 * default MIME charset is derived from the default Java charset, as
126 * mail messages is different than the charset used for files stored on
135 * encoding is assumed. Otherwise, unknown values cause a MessagingException
149 // cached map of whether a charset is compatible with ASCII
177 * The algorithm used here is: <br>
183 * If the primary type of this datasource is "text" and if all
185 * is "7bit". If more than half of the bytes are non-US-ASCII, then
186 * the encoding is "base64". If less than half of the bytes are
187 * non-US-ASCII, then the encoding is "quoted-printable".
189 * If the primary type of this datasource is not "text", then if
191 * is "7bit". If there is even one non-US-ASCII character, the
192 * encoding is "base64".
196 * @return the encoding. This is either "7bit",
201 InputStream is = null;
211 is = ds.getInputStream();
215 int i = checkAscii(is, ALL, !isText);
236 if (is != null)
237 is.close();
245 * Determine whether the charset in the Content-Type is compatible
246 * with ASCII or not. A charset is compatible with ASCII if the
247 * encoded byte stream representing the Unicode string "\r\n" is
249 * charset is not compatible with ASCII.
282 * <code>writeTo</code> method to examine the data. This is more
285 * "text/plain" String) because all the I/O is done in this
301 * the getEncoding(DataSource) method is typically faster. If
302 * the DataHandler was created with an object, this method is
308 * XXX - This is actually quite a disgusting hack, but it makes
357 * Decode the given input stream. The Input stream returned is
360 * "7bit", "8bit", and "binary". In addition, "uuencode" is also
364 * <code>mail.mime.ignoreunknownencoding</code> system property is set to
366 * original InputStream is returned.
368 * @param is input stream
371 * @exception MessagingException if the encoding is unknown
373 public static InputStream decode(InputStream is, String encoding)
376 return new BASE64DecoderStream(is);
378 return new QPDecoderStream(is);
382 return new UUDecoderStream(is);
386 return is;
390 return is;
398 * "binary". In addition, "uuencode" is also supported.
404 * @exception MessagingException if the encoding is unknown
430 * "binary". In addition, "uuencode" is also supported.
431 * The <code>filename</code> parameter is used with the "uuencode"
432 * encoding and is included in the encoded output.
468 * The given Unicode string is examined for non US-ASCII
470 * it is returned as-is. If the string contains non US-ASCII
471 * characters, it is first character-encoded using the platform's
509 * The given Unicode string is examined for non US-ASCII
511 * it is returned as-is. If the string contains non US-ASCII
512 * characters, it is first character-encoded using the specified
521 * @param charset the charset. If this parameter is null, the
522 * platform's default chatset is used.
524 * values are "B" and "Q". If this parameter is null, then
525 * the "Q" encoding is used if most of characters to be
527 * is used.
539 * Decode "unstructured" headers, that is, headers that are defined
542 * The string is decoded using the algorithm specified in
544 * for any sequence, an UnsupportedEncodingException is thrown.
545 * If the String is not an RFC 2047 style encoded header, it is
546 * returned as-is <p>
585 * return the string as-is, without suffering thru the later
608 // Check if token is an 'encoded-word' ..
621 // This is NOT an 'encoded-word'.
665 * The given Unicode string is examined for non US-ASCII
667 * it is returned as-is. If the string contains non US-ASCII
668 * characters, it is first character-encoded using the platform's
673 * This method is meant to be used when creating RFC 822 "phrases".
691 * The given Unicode string is examined for non US-ASCII
693 * it is returned as-is. If the string contains non US-ASCII
694 * characters, it is first character-encoded using the specified
702 * values are "B" and "Q". If this parameter is null, then
703 * the "Q" encoding is used if most of characters to be
705 * is used.
717 * be true if a RFC 822 "word" token is being encoded and false if a
718 * RFC 822 "text" token is being encoded. This is because the
740 // If no transfer-encoding is specified, figure one out.
785 // If the length is greater than 'avail', split 'string'
827 * The string is parsed using the rules in RFC 2047 and RFC 2231 for
828 * parsing an "encoded-word". If the parse fails, a ParseException is
829 * thrown. Otherwise, it is transfer-decoded, and then
831 * fails, an UnsupportedEncodingException is thrown.<p>
835 * @exception ParseException if the string is not an
887 InputStream is;
889 is = new BASE64DecoderStream(bis);
891 is = new QDecoderStream(bis);
898 // is certainly more efficient than writing bytes into a
903 // count is set to the actual number of decoded bytes
904 count = is.read(bytes, 0, count);
987 * This method is typically used during the generation of
999 return "\"\""; // an empty string is handled specially
1041 * Fold a string at linear whitespace so that each line is no longer
1043 * non-whitespace characters consecutively, the string is folded at
1046 * the current line; it is usually the length of the header name. <p>
1233 * @return the Java charset equivalent. If a suitable mapping is
1234 * not available, the passed in charset is itself returned.
1238 // no mapping table, or charset parameter is null
1254 * is not possible, the passed in charset itself
1255 * is returned.
1260 // no mapping table or charset param is null
1273 * is set, a system charset corresponding to this MIME charset will be
1283 * If mail.mime.charset is set, it controls the default
1342 InputStream is =
1346 if (is != null) {
1348 is = new LineInputStream(is);
1351 loadMappings((LineInputStream)is, java2mime);
1354 loadMappings((LineInputStream)is, mime2java);
1357 is.close();
1428 private static void loadMappings(LineInputStream is,
1434 currLine = is.readLine();
1449 // A valid entry is of the form <key><separator><value>
1499 * XXX - this method is no longer used
1507 // so that the resulting value is not a negative integer.
1524 * Upto <code>max</code> bytes are checked. If <code>max</code> is
1526 * input stream are checked. If <code>breakOnNonAscii</code> is true
1527 * the check terminates when the first non-US-ASCII character is
1528 * found and MOSTLY_NONASCII is returned. Else, the check continues
1531 * @param is the input stream
1537 * is found.
1543 static int checkAscii(InputStream is, int max, boolean breakOnNonAscii) {
1557 if ((len = is.read(buf, 0, block)) == -1)
1563 // bytes in the int so that the resulting value is
1597 // cannot say for sure that this input stream is ALL_ASCII,
1627 * it is all ASCII, mostly ASCII, or mostly non-ASCII.