本文整理汇总了Java中org.apache.james.mime4j.codec.Base64InputStream类的典型用法代码示例。如果您正苦于以下问题:Java Base64InputStream类的具体用法?Java Base64InputStream怎么用?Java Base64InputStream使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Base64InputStream类属于org.apache.james.mime4j.codec包,在下文中一共展示了Base64InputStream类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getDecodingInputStream
import org.apache.james.mime4j.codec.Base64InputStream; //导入依赖的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: decodeBase64
import org.apache.james.mime4j.codec.Base64InputStream; //导入依赖的package包/类
/**
* Decodes a string containing base64 encoded data.
*
* @param s the string to decode.
* @param monitor
* @return the decoded bytes.
*/
private static byte[] decodeBase64(String s, DecodeMonitor monitor) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try {
byte[] bytes = s.getBytes("US-ASCII");
Base64InputStream is = new Base64InputStream(
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,代码行数:28,代码来源:MimeWordDecoder.java
示例3: binaryBodyPart
import org.apache.james.mime4j.codec.Base64InputStream; //导入依赖的package包/类
private MimeBodyPart binaryBodyPart() throws IOException,
MessagingException {
String encodedTestString = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ "abcdefghijklmnopqrstuvwxyz0123456789+/";
BinaryTempFileBody tempFileBody = new BinaryTempFileBody();
InputStream in = new Base64InputStream(new ByteArrayInputStream(
encodedTestString.getBytes("UTF-8")));
OutputStream out = tempFileBody.getOutputStream();
try {
IOUtils.copy(in, out);
} finally {
out.close();
}
MimeBodyPart bodyPart = new MimeBodyPart(tempFileBody,
"application/octet-stream");
bodyPart.setEncoding(MimeUtil.ENC_BASE64);
return bodyPart;
}
开发者ID:daxslab,项目名称:daxSmail,代码行数:24,代码来源:MessageTest.java
示例4: decodeB
import org.apache.james.mime4j.codec.Base64InputStream; //导入依赖的package包/类
/**
* Decodes an encoded word encoded with the 'B' 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 decodeB(String encodedWord, String charset) {
byte[] bytes = encodedWord.getBytes(Charset.forName("US-ASCII"));
Base64InputStream is = new Base64InputStream(new ByteArrayInputStream(bytes));
try {
return CharsetSupport.readToString(is, charset);
} catch (IOException e) {
return null;
}
}
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:19,代码来源:DecoderUtil.java
注:本文中的org.apache.james.mime4j.codec.Base64InputStream类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论