InputStream is = null; try { is = part.getInputStream(); if (is8Bit(is)) {
InputStream is = null; try { is = part.getInputStream(); if (is8Bit(is)) {
@PublicAtsApi public List<InputStream> getAllStreams() throws PackageException { boolean storeReconnected = false; try { // store should be opened for actions including getting InputStream. storeReconnected = reconnectStoreIfClosed(); ArrayList<InputStream> streams = new ArrayList<InputStream>(); try { for (MimePart part : parts) { streams.add(part.getInputStream()); } } finally { closeStoreConnection(storeReconnected); } return streams; } catch (MessagingException me) { throw new PackageException("Could not read mime parts", me); } catch (IOException ioe) { throw new PackageException("Could not read mime parts", ioe); } }
/** * @param part * @return the plainText part encoded with the encoding given in the MIME header or UTF-8 encoded or null if the * plainText Part is not given */ public static String getPlainText(Part part) { String text = null; try { List<Part> bodyParts = getBodyParts(part); Part plainTextPart = getPlainTextPart(bodyParts); if (plainTextPart instanceof MimePart) { MimePart mimePart = (MimePart) plainTextPart; byte[] content = IOUtility.getContent(mimePart.getInputStream()); if (content != null) { try { text = new String(content, getCharacterEncodingOfMimePart(mimePart)); } catch (UnsupportedEncodingException e) { text = new String(content); } } } } catch (MessagingException | IOException e) { throw new ProcessingException("Unexpected: ", e); } return text; }
/** * Get the decoded data of a specified part * * @param partIndex * @return * @throws PackageException */ @PublicAtsApi public InputStream getRegularPartData( int partIndex ) throws PackageException { boolean storeReconnected = false; try { // store should be opened for actions including getting InputStream. // Hence store open is not in getPart storeReconnected = reconnectStoreIfClosed(); MimePart part = getPart(partIndex, false); return part.getInputStream(); } catch (MessagingException e) { throw new PackageException(e); } catch (IOException ioe) { throw new PackageException(ioe); } finally { try { closeStoreConnection(storeReconnected); } catch (MessagingException e) { log.error(e); } } }
/** * Return the attachment data * * @param partIndex * the index of the attachment * @return an InputStream with the attachment data * @throws PackageException */ @PublicAtsApi public InputStream getAttachmentPartData( int partIndex ) throws PackageException { try { boolean storeReconnected = reconnectStoreIfClosed(); // store should be opened for actions including getting InputStream. Hence store open is not in getPart try { MimePart part = getPart(partIndex, true); return part.getInputStream(); } finally { closeStoreConnection(storeReconnected); } } catch (MessagingException me) { throw new PackageException("Error getting attachment data for part " + partIndex, me); } catch (IOException ioe) { throw new PackageException("Error getting attachment data for part " + partIndex, ioe); } }
InputStream is = null; try { is = part.getInputStream(); if (is8Bit(is)) {
InputStream is = null; try { is = part.getInputStream(); if (is8Bit(is)) {
InputStream is = null; try { is = part.getInputStream(); if (is8Bit(is)) {
if (isValid8bit(bodyPart.getInputStream())) {
InputStream is = null; try { is = part.getInputStream(); if (is8Bit(is)) {
InputStream is = null; try { is = part.getInputStream(); if (is8Bit(is)) {
InputStream is = null; try { is = part.getInputStream(); if (is8Bit(is)) {
if (enc != null && (enc.equalsIgnoreCase("quoted-printable") || enc.equalsIgnoreCase("base64"))) { InputStream is = part.getInputStream(); if (is8Bit(is)) {