/** Cache the messages in memory */ public void deliver(String from, String recipient, InputStream data) throws TooMuchDataException, IOException { ByteArrayOutputStream out = new ByteArrayOutputStream(); data = new BufferedInputStream(data); // read the data from the stream int current; while ((current = data.read()) >= 0) { out.write(current); } // create a new WiserMessage. messages.add(new WiserMessage(this, from, recipient, out.toByteArray())); }
/** Cache the messages in memory */ public void deliver(String from, String recipient, InputStream data) throws TooMuchDataException, IOException { if (log.isDebugEnabled()) log.debug("Delivering mail from " + from + " to " + recipient); ByteArrayOutputStream out = new ByteArrayOutputStream(); data = new BufferedInputStream(data); // read the data from the stream int current; while ((current = data.read()) >= 0) { out.write(current); } byte[] bytes = out.toByteArray(); if (log.isDebugEnabled()) log.debug("Creating message from data with " + bytes.length + " bytes"); // create a new WiserMessage. this.messages.add(new WiserMessage(this, from, recipient, bytes)); }
/** Cache the messages in memory */ @Override public void deliver(String from, String recipient, InputStream data) throws TooMuchDataException, IOException { log.debug("Delivering mail from {} to {}", from, recipient); ByteArrayOutputStream out = new ByteArrayOutputStream(); data = new BufferedInputStream(data); // read the data from the stream int current; while ((current = data.read()) >= 0) { out.write(current); } byte[] bytes = out.toByteArray(); log.debug("Creating message from data with {} bytes", bytes.length); Session session = Session.getDefaultInstance(new Properties()); // create a new WiserMessage. this.messages.add(new WiserMessage(session, from, recipient, bytes)); }
/** Cache the messages in memory */ public void deliver(String from, String recipient, InputStream data) throws TooMuchDataException, IOException { if (log.isDebugEnabled()) log.debug("Delivering mail from " + from + " to " + recipient); ByteArrayOutputStream out = new ByteArrayOutputStream(); data = new BufferedInputStream(data); // read the data from the stream int current; while ((current = data.read()) >= 0) { out.write(current); } byte[] bytes = out.toByteArray(); if (log.isDebugEnabled()) log.debug("Creating message from data with " + bytes.length + " bytes"); // create a new WiserMessage. this.messages.add(new WiserMessage(this, from, recipient, bytes)); }