use of org.openintents.openpgp.util.OpenPgpApi.OpenPgpDataSink in project k-9 by k9mail.
the class MessageCryptoHelper method getDataSinkForDecryptedInlineData.
private OpenPgpDataSink<MimeBodyPart> getDataSinkForDecryptedInlineData() {
return new OpenPgpDataSink<MimeBodyPart>() {
@Override
public MimeBodyPart processData(InputStream is) throws IOException {
try {
ByteArrayOutputStream decryptedByteOutputStream = new ByteArrayOutputStream();
IOUtils.copy(is, decryptedByteOutputStream);
TextBody body = new TextBody(new String(decryptedByteOutputStream.toByteArray()));
return new MimeBodyPart(body, "text/plain");
} catch (MessagingException e) {
Timber.e(e, "MessagingException");
}
return null;
}
};
}
Aggregations