public static Optional<MediaType> byFile(final File file) {
    requireNonNull(file, "A file is required.");
    return byPath(file.getName());
  }
public static Optional<MediaType> byFile(final File file) {
    requireNonNull(file, "A file is required.");
    return byPath(file.getName());
  }
public static Optional < MediaType > byFile ( final File file ) { requireNonNull ( file , "A file is required." ) ; return byPath ( file . getName ( ) ) ; }
Get a {@link MediaType} for a file.

@param file A candidate file.
@return A {@link MediaType} or {@link MediaType#octetstream} for unknown file extensions.
Get a { @link MediaType } for a file .