/** * @see #writeStream(FileOutputStream, InputStream) */ public static void writeStream(final File dest, final InputStream in) throws IOException { writeStream(new FileOutputStream(dest, false), in); }
/** * @see #writeStream(File, InputStream) */ public static void writeStream(final String dest, final InputStream in) throws IOException { writeStream(file(dest), in); }
/** * Creates {@link EmailAttachment}. * * @return {@link EmailAttachment}. * @throws MailException if issue with {@link DataSource}. */ public EmailAttachment<FileDataSource> buildFileDataSource(final String messageId, final File attachmentStorage) throws MailException { try { final FileDataSource fds; if (dataSource instanceof FileDataSource) { fds = (FileDataSource) dataSource; } else { final File file = new File(attachmentStorage, messageId); FileUtil.writeStream(file, dataSource.getInputStream()); fds = new FileDataSource(file); } checkDataSource(); return new EmailAttachment<>(name, contentId, isInline, fds).setEmbeddedMessage(targetMessage); } catch (final IOException ioexc) { throw new MailException(ioexc); } }
in = fileUpload.getFileInputStream(); File tempFile = FileUtil.createTempFile(); FileUtil.writeStream(tempFile, in); return tempFile; } catch (IOException ioex) {
/** * @see #writeStream(FileOutputStream, InputStream) */ public static void writeStream(final File dest, final InputStream in) throws IOException { writeStream(new FileOutputStream(dest, false), in); }
/** * @see #writeStream(File, InputStream) */ public static void writeStream(final String dest, final InputStream in) throws IOException { writeStream(file(dest), in); }
/** * Creates {@link EmailAttachment}. * * @return {@link EmailAttachment}. * @throws MailException if issue with {@link DataSource}. */ public EmailAttachment<FileDataSource> buildFileDataSource(final String messageId, final File attachmentStorage) throws MailException { try { final FileDataSource fds; if (dataSource instanceof FileDataSource) { fds = (FileDataSource) dataSource; } else { final File file = new File(attachmentStorage, messageId); FileUtil.writeStream(file, dataSource.getInputStream()); fds = new FileDataSource(file); } checkDataSource(); return new EmailAttachment<>(name, contentId, isInline, fds).setEmbeddedMessage(targetMessage); } catch (final IOException ioexc) { throw new MailException(ioexc); } }
in = fileUpload.getFileInputStream(); File tempFile = FileUtil.createTempFile(); FileUtil.writeStream(tempFile, in); return tempFile; } catch (IOException ioex) {