public final class MimeMappings extends Object implements 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(Map<String,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 |
---|---|
String |
add(String extension,
String mimeType)
Add a new mime mapping.
|
boolean |
equals(Object obj) |
String |
get(String extension)
Get a mime mapping for the given extension.
|
Collection<MimeMappings.Mapping> |
getAll()
Returns all defined mappings.
|
int |
hashCode() |
Iterator<MimeMappings.Mapping> |
iterator() |
String |
remove(String extension)
Remove an existing mapping.
|
static MimeMappings |
unmodifiableMappings(MimeMappings mappings)
Create a new unmodifiable view of the specified mapping.
|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
public static final MimeMappings DEFAULT
public MimeMappings()
MimeMappings
instance.public MimeMappings(MimeMappings mappings)
MimeMappings
instance from the specified mappings.mappings
- the source mappingspublic MimeMappings(Map<String,String> mappings)
MimeMappings
from the specified mappings.mappings
- the source mappings with extension as the key and mime-type as the
valuepublic Iterator<MimeMappings.Mapping> iterator()
iterator
in interface Iterable<MimeMappings.Mapping>
public Collection<MimeMappings.Mapping> getAll()
public String add(String extension, String mimeType)
extension
- the file extension (excluding '.')mimeType
- the mime type to mapnull
public String get(String extension)
extension
- the file extension (excluding '.')null
public String remove(String extension)
extension
- the file extension (excluding '.')null
if no item was removedpublic static MimeMappings unmodifiableMappings(MimeMappings mappings)
UnsupportedOperationException
s.mappings
- the mappingsCopyright © 2016 Pivotal Software, Inc.. All rights reserved.