Пример #1
0
  /**
   * 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());
  }
Пример #2
0
 /**
  * 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);
 }
Пример #3
0
 @Override
 public MimeType getMimeType() {
   return MimeType.fromFileName(getName());
 }