public InputStream attachmentInputStream(ERDatabaseAttachment attachment) throws FileNotFoundException {
NSData data = attachment.smallData();
if (data == null) {
ERAttachmentData attachmentData = attachment.attachmentData();
if (attachmentData != null) {
data = attachmentData.data();
}
}
InputStream attachmentInputStream;
if (data != null) {
attachmentInputStream = data.stream();