/** * Construct a new attachment builder. * @param fileName the filename to include. * @param content an input stream for the content. * @throws IllegalArgumentException in case either the fileName or the content is null. */ public Builder(String fileName, InputStream content) { if (fileName == null) { throw new IllegalArgumentException("File name mustn't be null"); } if (content == null) { throw new IllegalArgumentException("Content mustn't be null"); } this.fileName = fileName; this.content = encodeToBase64(content); }