Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import android.webkit.MimeTypeMap;

public class Main {
    public static String getMineType(String path) {
        String suffix = getSuffix(path);
        return MimeTypeMap.getSingleton().getMimeTypeFromExtension(suffix.toLowerCase());
    }

    public static String getSuffix(String fileName) {
        if (fileName == null)
            return null;
        int point = fileName.lastIndexOf(".");
        if (point != -1) {
            return fileName.substring(point + 1);
        }
        return fileName;
    }
}