All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.g2forge.alexandria.media.IMediaRegistry Maven / Gradle / Ivy

There is a newer version: 0.0.18
Show newest version
package com.g2forge.alexandria.media;

import java.util.Collection;
import java.util.List;
import java.util.stream.Collectors;

import com.g2forge.alexandria.java.core.helpers.HCollection;
import com.g2forge.alexandria.java.io.Filename;

public interface IMediaRegistry {
	public default IMediaType computeMediaType(Filename filename) {
		final String extension = filename.getLastExtension();
		final List matches = getMediaTypes().stream().filter(mediaType -> mediaType.getFileExtensions().isMatch(extension)).collect(Collectors.toList());
		if (matches.isEmpty()) return null;
		return HCollection.getOne(matches);
	}

	public Collection getMediaTypes();
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy