本文整理汇总了Java中org.apache.james.mime4j.codec.QuotedPrintableInputStream类的典型用法代码示例。如果您正苦于以下问题:Java QuotedPrintableInputStream类的具体用法?Java QuotedPrintableInputStream怎么用?Java QuotedPrintableInputStream使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
QuotedPrintableInputStream类属于org.apache.james.mime4j.codec包,在下文中一共展示了QuotedPrintableInputStream类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getDecodingInputStream
import org.apache.james.mime4j.codec.QuotedPrintableInputStream; //导入依赖的package包/类
InputStream getDecodingInputStream(final InputStream rawInputStream, @Nullable String encoding) {
if (MimeUtil.ENC_BASE64.equals(encoding)) {
return new Base64InputStream(rawInputStream) {
@Override
public void close() throws IOException {
super.close();
rawInputStream.close();
}
};
}
if (MimeUtil.ENC_QUOTED_PRINTABLE.equals(encoding)) {
return new QuotedPrintableInputStream(rawInputStream) {
@Override
public void close() throws IOException {
super.close();
rawInputStream.close();
}
};
}
return rawInputStream;
}
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:23,代码来源:LocalStore.java
示例2: decodeQ
import org.apache.james.mime4j.codec.QuotedPrintableInputStream; //导入依赖的package包/类
/**
* Decodes an encoded word encoded with the 'Q' encoding (described in
* RFC 2047) found in a header field body.
*
* @param encodedWord the encoded word to decode.
* @param charset the Java charset to use.
* @return the decoded string.
*/
private static String decodeQ(String encodedWord, String charset) {
/*
* Replace _ with =20
*/
StringBuilder sb = new StringBuilder();
for (int i = 0; i < encodedWord.length(); i++) {
char c = encodedWord.charAt(i);
if (c == '_') {
sb.append("=20");
} else {
sb.append(c);
}
}
byte[] bytes = sb.toString().getBytes(Charset.forName("US-ASCII"));
QuotedPrintableInputStream is = new QuotedPrintableInputStream(new ByteArrayInputStream(bytes));
try {
return CharsetSupport.readToString(is, charset);
} catch (IOException e) {
return null;
}
}
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:33,代码来源:DecoderUtil.java
示例3: decodeQuotedPrintable
import org.apache.james.mime4j.codec.QuotedPrintableInputStream; //导入依赖的package包/类
/**
* Decodes a string containing quoted-printable encoded data.
*
* @param s the string to decode.
* @return the decoded bytes.
*/
private static byte[] decodeQuotedPrintable(String s, DecodeMonitor monitor) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try {
byte[] bytes = s.getBytes("US-ASCII");
QuotedPrintableInputStream is = new QuotedPrintableInputStream(
new ByteArrayInputStream(bytes), monitor);
int b = 0;
while ((b = is.read()) != -1) {
baos.write(b);
}
} catch (IOException e) {
// This should never happen!
throw new IllegalStateException(e);
}
return baos.toByteArray();
}
开发者ID:ram-sharma-6453,项目名称:email-mime-parser,代码行数:27,代码来源:MimeWordDecoder.java
注:本文中的org.apache.james.mime4j.codec.QuotedPrintableInputStream类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论