in freemarker-generator-base/src/main/java/org/apache/freemarker/generator/base/datasource/DataSourceFactory.java [125:138]
public static DataSource fromFile(
String name,
String group,
File file,
Charset charset,
Map<String, String> properties) {
Validate.isTrue(file.exists(), "File not found: " + file);
final FileDataSource dataSource = new FileDataSource(file);
// content type is determined from file extension
dataSource.setFileTypeMap(MimetypesFileTypeMapFactory.create());
final String contentType = dataSource.getContentType();
return create(name, group, file.toURI(), dataSource, contentType, charset, properties);
}