/** * @deprecated (4.2) use {@link #NFileEntity(File, ContentType, boolean)} */ @Deprecated public NFileEntity(final File file, final String contentType, final boolean useFileChannels) { Args.notNull(file, "File"); this.file = file; this.useFileChannels = useFileChannels; setContentType(contentType); }
/** * @deprecated (4.2) use {@link #NFileEntity(File, ContentType, boolean)} */ @Deprecated public NFileEntity(final File file, final String contentType, final boolean useFileChannels) { Args.notNull(file, "File"); this.file = file; this.useFileChannels = useFileChannels; setContentType(contentType); }
/** * Creates new instance of NFileEntity from the given source {@link File} * with the given content type. If {@code useFileChannels} is set to * {@code true}, the entity will try to use {@link FileContentEncoder} * interface to stream file content directly from the file channel. * * @param file the source file. * @param contentType the content type of the file. * @param useFileChannels flag whether the direct transfer from the file * channel should be attempted. * * @since 4.2 */ public NFileEntity(final File file, final ContentType contentType, final boolean useFileChannels) { Args.notNull(file, "File"); this.file = file; this.useFileChannels = useFileChannels; if (contentType != null) { setContentType(contentType.toString()); } }
/** * Creates new instance of NFileEntity from the given source {@link File} * with the given content type. If {@code useFileChannels} is set to * {@code true}, the entity will try to use {@link FileContentEncoder} * interface to stream file content directly from the file channel. * * @param file the source file. * @param contentType the content type of the file. * @param useFileChannels flag whether the direct transfer from the file * channel should be attempted. * * @since 4.2 */ public NFileEntity(final File file, final ContentType contentType, final boolean useFileChannels) { Args.notNull(file, "File"); this.file = file; this.useFileChannels = useFileChannels; if (contentType != null) { setContentType(contentType.toString()); } }