@Override public InputStream getInputStream() { try { return (file != null ? new SelfClosingInputStream( new BufferedInputStream( new FileInputStream(file))) : dummyStream()); } catch (FileNotFoundException ex) { /* * Silently return null; validateFile has already logged a message * when the original caller tried to add this file to * the payload. */ return null; } }
@Override public InputStream getInputStream() { try { return (file != null ? new SelfClosingInputStream( new BufferedInputStream( new FileInputStream(file))) : dummyStream()); } catch (FileNotFoundException ex) { /* * Silently return null; validateFile has already logged a message * when the original caller tried to add this file to * the payload. */ return null; } }
/** * Creates a new Part from a File. * @param contentType content type for the Part * @param name name of the Part * @param props Properties to be associated with the Part * @param file File containing the content for the Part * @return */ public static Part newInstance( final String contentType, final String name, final Properties props, final File file) throws FileNotFoundException { return new Filed(contentType, name, props, file); }
@Override public InputStream getInputStream() { try { return (file != null ? new SelfClosingInputStream( new BufferedInputStream( new FileInputStream(file))) : dummyStream()); } catch (FileNotFoundException ex) { /* * Silently return null; validateFile has already logged a message * when the original caller tried to add this file to * the payload. */ return null; } }
/** * Creates a new Part from a File. * @param contentType content type for the Part * @param name name of the Part * @param props Properties to be associated with the Part * @param file File containing the content for the Part * @return */ public static Part newInstance( final String contentType, final String name, final Properties props, final File file) throws FileNotFoundException { return new Filed(contentType, name, props, file); }
Filed(final String contentType, final String name, final Properties props, final File file) throws FileNotFoundException { super(contentType, name, props); this.file = file; validateFile(file); }
/** * Creates a new Part from a File. * @param contentType content type for the Part * @param name name of the Part * @param props Properties to be associated with the Part * @param file File containing the content for the Part * @return */ public static Part newInstance( final String contentType, final String name, final Properties props, final File file) throws FileNotFoundException { return new Filed(contentType, name, props, file); }
Filed(final String contentType, final String name, final Properties props, final File file) throws FileNotFoundException { super(contentType, name, props); this.file = file; validateFile(file); }
Filed(final String contentType, final String name, final Properties props, final File file) throws FileNotFoundException { super(contentType, name, props); this.file = file; validateFile(file); }