/** * Create a FileDocument * * @param file {@code File} */ public FileDocument(final File file) { if (file == null) { throw new NullPointerException(); } if (!file.exists()) { throw new DSSException("File Not Found: " + file.getAbsolutePath()); } this.file = file; this.mimeType = MimeType.fromFileName(file.getName()); }
/** * Creates dss document that retains the data in memory * * @param bytes array of bytes representing the document * @param name the file name if the data originates from a file */ public InMemoryDocument(final byte[] bytes, final String name) { this.bytes = bytes; this.name = name; this.mimeType = MimeType.fromFileName(name); }
@Override public MimeType getMimeType() { return MimeType.fromFileName(getName()); }