public void writeToStream ( final OutputStream out ) { InputStream input = null ; try { input = getDataSource ( ) . getInputStream ( ) ; StreamUtil . copy ( input , out ) ; } catch ( final IOException ioex ) { throw new MailException ( ioex ) ; } finally { StreamUtil . close ( input ) ; } }
Saves attachment to the output stream .