Example usage for javax.activation FileDataSource setFileTypeMap

List of usage examples for javax.activation FileDataSource setFileTypeMap

Introduction

In this page you can find the example usage for javax.activation FileDataSource setFileTypeMap.

Prototype

public void setFileTypeMap(FileTypeMap map) 

Source Link

Document

Set the FileTypeMap to use with this FileDataSource

Usage

From source file:eu.planets_project.services.datatypes.ImmutableContent.java

/**
 * @param reference The content reference, as a file.
 *///from ww  w.jav  a2 s . c  om
ImmutableContent(final File reference) {
    if (reference == null)
        throw new IllegalArgumentException("File parameter must not be null!");
    FileDataSource ds = new FileDataSource(reference);
    ds.setFileTypeMap(FileTypeMap.getDefaultFileTypeMap());
    DataHandler dh = new DataHandler(ds);
    this.length = reference.length();
    this.dataHandler = dh;
    log.info("Created Content from file: " + reference.getAbsolutePath() + "': " + this.length
            + " bytes in length.");
}