⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 customfilenamemap.java

📁 FMJ(freedom media for java)是java视频开发的新选择
💻 JAVA
字号:
package net.sf.fmj.utility;import java.net.FileNameMap;import java.util.HashMap;import java.util.Map;/** *  * Used to add mappings that are not in content-types.properties * @author Ken Larson * */public class CustomFileNameMap implements FileNameMap{	// The "real" one is accessed using URLConnection.getFileNameMap().	// This class can be used together with the "real" to make one fill in the defaults for/override the other.	// then use URLConnection.setFileNameMap().			private final Map map = new HashMap();	public void map(String[] exts, String type)	{		for (int i = 0; i < exts.length; ++i)		{			map(exts[i], type);		}	}	public void map(String ext, String type)	{		if (ext.startsWith("."))			throw new IllegalArgumentException("Extension should not include dot");				map.put(ext.toLowerCase(), type);	}		public String getType(String ext)	{		if (ext == null)			return null;		return (String) map.get(ext.toLowerCase());	}		public String getContentTypeFor(String fileName)	{		return getType(PathUtils.extractExtension(fileName));	}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -