Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.Hashtable;

public class Main {
    public static Hashtable<String, String> theMimeTypes = new Hashtable<String, String>();

    public static String getMimeType(String url) {
        String mime = null;
        int dot = url.lastIndexOf('.');
        if (url.contains(".m3u8")) {
            mime = "video/mp4";
            return mime;
        }
        if (dot >= 0)
            mime = (String) theMimeTypes.get(url.substring(dot + 1).toLowerCase());
        if (mime == null)
            mime = "application/octet-stream";
        return mime;
    }
}