开发者

Is there a helper function to find a mime type corresponding to an extension

Mime types corresponding to an extension is available over here. We currently have the following code to translate this for the most commonly used extension types.

     String getContentType(String extension) {
        if (extens开发者_运维问答ion.equals("png") || extension.equals("gif")
                || extension.equals("ico") || extension.equals("tiff")) {
            contentType = "image/" + extension;
        } else if (extension.equals("jpg") || extension.equals("jpeg")) {
            contentType = "image/jpeg";
        } 
        ........
     }

But is there a function in a open source library which provides this complete mapping?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜