@Test public void testByteArrayIterator_CreateFromFake() throws Exception { ByteArrayIterator m = MimeHelper.createByteArrayIterator(AdaptrisMessageFactory.getDefaultInstance().newMessage(MIME_PAYLOAD)); assertNotNull(m); assertEquals(2, m.size()); }
public static ByteArrayIterator createByteArrayIterator(AdaptrisMessage msg) throws IOException, MessagingException { ByteArrayIterator result = null; try (InputStream in = msg.getInputStream()) { result = new ByteArrayIterator(in); } catch (Exception e) { String mimeBoundary = getBoundary(msg); result = createByteArrayIterator(mimeFaker(msg, mimeBoundary)); } if (result == null) { throw new IOException("Could not parse " + msg.getUniqueId() + " into a standard MIME Multipart"); } return result; }
MimeHelper { public static ByteArrayIterator createByteArrayIterator(AdaptrisMessage msg) throws IOException, MessagingException { ByteArrayIterator result = null; try (InputStream in = msg.getInputStream()) { result = new ByteArrayIterator(in); } catch (Exception e) { String mimeBoundary = getBoundary(msg); result = createByteArrayIterator(mimeFaker(msg, mimeBoundary)); } if (result == null) { throw new IOException("Could not parse " + msg.getUniqueId() + " into a standard MIME Multipart"); } return result; } }
MimeHelper { public static ByteArrayIterator createByteArrayIterator(AdaptrisMessage msg) throws IOException, MessagingException { ByteArrayIterator result = null; try (InputStream in = msg.getInputStream()) { result = new ByteArrayIterator(in); } catch (Exception e) { String mimeBoundary = getBoundary(msg); result = createByteArrayIterator(mimeFaker(msg, mimeBoundary)); } if (result == null) { throw new IOException("Could not parse " + msg.getUniqueId() + " into a standard MIME Multipart"); } return result; }  }
MimeHelper { public static ByteArrayIterator createByteArrayIterator(AdaptrisMessage msg) throws IOException, MessagingException { ByteArrayIterator result = null; try (InputStream in = msg.getInputStream()) { result = new ByteArrayIterator(in); } catch (Exception e) { String mimeBoundary = getBoundary(msg); result = createByteArrayIterator(mimeFaker(msg, mimeBoundary)); } if (result == null) { throw new IOException("Could not parse " + msg.getUniqueId() + " into a standard MIME Multipart"); } return result; }  static ByteArrayIterator createByteArrayIterator(AdaptrisMessage msg); static BodyPartIterator createBodyPartIterator(AdaptrisMessage msg); }
MimeHelper { public static ByteArrayIterator createByteArrayIterator(AdaptrisMessage msg) throws IOException, MessagingException { ByteArrayIterator result = null; try (InputStream in = msg.getInputStream()) { result = new ByteArrayIterator(in); } catch (Exception e) { String mimeBoundary = getBoundary(msg); result = createByteArrayIterator(mimeFaker(msg, mimeBoundary)); } if (result == null) { throw new IOException("Could not parse " + msg.getUniqueId() + " into a standard MIME Multipart"); } return result; }  static ByteArrayIterator createByteArrayIterator(AdaptrisMessage msg); static BodyPartIterator createBodyPartIterator(AdaptrisMessage msg);  }