public final class MimeMappings extends java.lang.Object implements java.lang.Iterable<MimeMappings.Mapping>
Modifier and Type | Class and Description |
---|---|
static class |
MimeMappings.Mapping
A single mime mapping.
|
Modifier and Type | Field and Description |
---|---|
static MimeMappings |
DEFAULT
Default mime mapping commonly used.
|
Constructor and Description |
---|
MimeMappings()
Create a new empty
MimeMappings instance. |
MimeMappings(java.util.Map<java.lang.String,java.lang.String> mappings)
Create a new
MimeMappings from the specified mappings. |
MimeMappings(MimeMappings mappings)
Create a new
MimeMappings instance from the specified mappings. |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
add(java.lang.String extension,
java.lang.String mimeType)
Add a new mime mapping.
|
boolean |
equals(java.lang.Object obj) |
java.lang.String |
get(java.lang.String extension)
Get a mime mapping for the given extension.
|
java.util.Collection<MimeMappings.Mapping> |
getAll()
Returns all defined mappings.
|
int |
hashCode() |
java.util.Iterator<MimeMappings.Mapping> |
iterator() |
java.lang.String |
remove(java.lang.String extension)
Remove an existing mapping.
|
static MimeMappings |
unmodifiableMappings(MimeMappings mappings)
Create a new unmodifiable view of the specified mapping.
|
public static final MimeMappings DEFAULT
public MimeMappings()
MimeMappings
instance.public MimeMappings(MimeMappings mappings)
MimeMappings
instance from the specified mappings.mappings
- the source mappingspublic MimeMappings(java.util.Map<java.lang.String,java.lang.String> mappings)
MimeMappings
from the specified mappings.mappings
- the source mappings with extension as the key and mime-type as the
valuepublic java.util.Iterator<MimeMappings.Mapping> iterator()
iterator
in interface java.lang.Iterable<MimeMappings.Mapping>
public java.util.Collection<MimeMappings.Mapping> getAll()
public java.lang.String add(java.lang.String extension, java.lang.String mimeType)
extension
- the file extension (excluding '.')mimeType
- the mime type to mapnull
public java.lang.String get(java.lang.String extension)
extension
- the file extension (excluding '.')null
public java.lang.String remove(java.lang.String extension)
extension
- the file extension (excluding '.')null
if no item was removedpublic boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public static MimeMappings unmodifiableMappings(MimeMappings mappings)
UnsupportedOperationException
s.mappings
- the mappings