| Author | DaveJarvis <email> |
|---|---|
| Date | 2023-01-08 12:17:31 GMT-0800 |
| Commit | 302d393d8964661442e4ce7d6b3e983865d8a1d9 |
| Parent | 0d77f40 |
| Delta | 13 lines added, 0 lines removed, 13-line increase |
| package com.keenwrite.io; | ||
| +import org.apache.commons.io.FilenameUtils; | ||
| + | ||
| +import java.io.File; | ||
| import java.util.List; | ||
| return UNDEFINED; | ||
| + } | ||
| + | ||
| + /** | ||
| + * Returns the {@link MediaType} associated with the given file. | ||
| + * | ||
| + * @param file The file having an extension to map to a {@link MediaType}. | ||
| + * @return The associated {@link MediaType} as defined by IANA. | ||
| + */ | ||
| + public static MediaType fromFile( final File file ) { | ||
| + return fromExtension( FilenameUtils.getExtension( file.getName() ) ); | ||
| } | ||