* @throws IOException if resource access failed
* @see javax.activation.MimetypesFileTypeMap#MimetypesFileTypeMap(java.io.InputStream)
* @see javax.activation.MimetypesFileTypeMap#addMimeTypes(String)
*/
protected FileTypeMap createFileTypeMap(Resource mappingLocation, String[] mappings) throws IOException {
MimetypesFileTypeMap fileTypeMap = null;
if (mappingLocation != null) {
InputStream is = mappingLocation.getInputStream();
try {
fileTypeMap = new MimetypesFileTypeMap(is);
}
finally {
is.close();
}
}
else {
fileTypeMap = new MimetypesFileTypeMap();
}
if (mappings != null) {
for (String mapping : mappings) {
fileTypeMap.addMimeTypes(mapping);
}
}
return fileTypeMap;
}