Add a new mime mapping.
@param extension the file extension (excluding '.')
@param mimeType the mime type to map
@return any previous mapping or {@code null}
15867
public String add(String extension, String mimeType) {
		Mapping previous = this.map.put(extension, new Mapping(extension, mimeType));
		return (previous != null) ? previous.getMimeType() : null;
	}
726355
public static String getMimeType(String url)
	{
	    String type = null;
	    String extension = MimeTypeMap.getFileExtensionFromUrl(url);
	    if (extension != null) {
	        MimeTypeMap mime = MimeTypeMap.getSingleton();
	        type = mime.getMimeTypeFromExtension(extension);
	    }
	    return type;
	}
878536
static public void addKnownString(String mimeType, String knownString) {
		Map<String,String> map = getKnownStrings();
		if( null != mimeType && null != knownString ) {
			map.put(knownString.trim(), mimeType.trim());
		}
	}
163875
public function addMimeType($mimeType)
    {
        if (!in_array($mimeType, $this->mimeTypes)) {
            $this->mimeTypes[] = $mimeType;
        }

        return $this;
    }
1222391
public void setMimeType(com.google.api.ads.admanager.axis.v201805.MimeType mimeType) {
        this.mimeType = mimeType;
    }
822075
public void setMimeType(MimeType mimeType) {
        if (mimeType != null) {
            getState().mimeType = mimeType.getMimeType();
        } else {
            getState().mimeType = null;
        }
    }
513069
function _gpfGetMimeType (fileExtension) {
    var mimeType = _gpfMimeTypesFromExtension[fileExtension.toLowerCase()];
    if (undefined === mimeType) {
        // Default
        mimeType = "application/octet-stream";
    }
    return mimeType;
}
245515
private static final String getExtension(String MIMETYPE) throws Exception {
        if (m_extensionMappings == null) {
            m_extensionMappings = readExtensionMappings(Server.FEDORA_HOME + "/server/" + Server.CONFIG_DIR + "/" + DATASTREAM_MAPPING_SOURCE_FILE);
        }

        String extension = m_extensionMappings.get(MIMETYPE);
        if (extension != null) {
            return extension;
        } else {
            return "";
        }
    }
1330128
public FileFilterBuilder addExtensions(Iterable<String> extensions) {
        for (String extension : extensions) {
            // Ultimately, SuffixFileFilter will be used, and the "." needs to be explicit.
            this.extensions.add(extension.startsWith(".") ? extension : "." + extension);
        }
        return this;
    }
475794
public static boolean hasMimeType(String mimeType) {
        if (mimeType == null || mimeType.isEmpty()) {
            return false;
        }
        return mimeTypeToExtensionMap.containsKey(mimeType);
    }
1052005
public X509Extension add(X509Extension extension) {
	if (extension == null) {
	    throw new IllegalArgumentException(i18n
                                               .getMessage("extensionNull"));
	}
	return (X509Extension)this.extensions.put(extension.getOid(),
						  extension);
    }
907207
public <T extends Assignable> String getExtensionFromExtensionMapping(final Class<T> type) {
        ExtensionWrapper extensionWrapper = extensionMappings.get(type);
        if (extensionWrapper == null) {
            loadExtensionMapping(type);
        }
        extensionWrapper = extensionMappings.get(type);
        if (extensionWrapper == null) {
            throw UnknownExtensionTypeExceptionDelegator.newExceptionInstance(type);
        }
        return extensionWrapper.getProperty("extension");
    }
501722
public function addMimeTypeToExtension($mime_type, $extension)
    {
        if (is_array($extension)) {
            $this->mime_type_to_extensions[$mime_type] = $extension;
        } else {
            $this->mime_type_to_extensions[$mime_type] = array($extension);
        }

        return true;
    }
227935
public static String getMimeTypeFromExtension(String extension) {
        if (extension == null || extension.length() == 0) {
            return null;
        }
        return extensionToMimeTypeMap.get(extension);
    }
1251787
public function getExtension($mimetype)
	{
		$key = array_search($mimetype, $this->mimeTypes);

		if (!$key)
		{
			$key = '';
		}

		return $key;
	}
1112085
private void initializeMimeExtensionArrays() throws OSException {
        // lazy initialization
        if (extensionMime == null || mimeExtension == null) {
            extensionMime = new HashMap<>();
            mimeExtension = new HashMap<>();

            // list all files in all directories in MIME_TYPE_FILES
            for (String dir : MIME_TYPE_FILES) {
                File d = new File(dir);
                if (d.exists() && d.isDirectory()) {
                    for (final File fileEntry : d.listFiles()) {
                        if (fileEntry.isFile() && fileEntry.canRead()) {
                            Set<String> tmpExtensions = new HashSet<>();
                            Set<String> tmpMimeTypes = new HashSet<>();
                            try {
                                String content = new String(Files.readAllBytes(fileEntry.toPath()));

                                Matcher extMatcher = MIME_TYPE_FILE_EXTENSION_PATTERN.matcher(content);
                                while (extMatcher.find()) {
                                    tmpExtensions.add(extMatcher.group(1).toLowerCase());
                                }

                                Matcher mimeMatcher = MIME_TYPE_FILE_MIME_PATTERN.matcher(content);
                                while (mimeMatcher.find()) {
                                    tmpMimeTypes.add(mimeMatcher.group(1).toLowerCase());
                                }
                            } catch (IOException ex) {
                                throw new OSException(ex);
                            }

                            // fill arrays
                            for (String ext : tmpExtensions) {
                                if (extensionMime.containsKey(ext)) {
                                    Set<String> tmp = extensionMime.get(ext);
                                    tmp.addAll(tmpMimeTypes);
                                    extensionMime.put(ext, tmp);
                                } else {
                                    extensionMime.put(ext, tmpMimeTypes);
                                }
                            }
                            for (String mime : tmpMimeTypes) {
                                if (mimeExtension.containsKey(mime)) {
                                    Set<String> tmp = mimeExtension.get(mime);
                                    tmp.addAll(tmpExtensions);
                                    mimeExtension.put(mime, tmp);
                                } else {
                                    mimeExtension.put(mime, tmpExtensions);
                                }
                            }
                        }
                    }
                }
            }
        }
    }
1055538
private DefaultLocalExtension createExtension(Extension extension)
    {
        DefaultLocalExtension localExtension = new DefaultLocalExtension(this, extension);

        localExtension.setFile(this.storage.getNewExtensionFile(localExtension.getId(), localExtension.getType()));

        return localExtension;
    }