Java Activation Mimetype Check isFileImage(String fileName)

Here you can find the source of isFileImage(String fileName)

Description

is File Image

License

Open Source License

Declaration

public static boolean isFileImage(String fileName) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import javax.activation.MimetypesFileTypeMap;

public class Main {
    private static MimetypesFileTypeMap mtftp = new MimetypesFileTypeMap();

    public static boolean isFileImage(String fileName) {

        String mimetype = mtftp.getContentType(fileName);
        String type = mimetype.split("/")[0];
        return type.equals("image");
    }/*from  w w  w.  j a v  a 2s. c o m*/
}

Related

  1. getMimeType(final String filename)
  2. getMimetype(String filename)
  3. getMimeTypeForFileName(String filename)
  4. init()
  5. initFileTypeMap()
  6. isImage(String fileName, boolean output)
  7. isMimeType(String a)
  8. isValidateContentType(String contentType)
  9. setMinetypes()