Package com.jk.web.embedded.spring
Class MimeMappings
java.lang.Object
com.jk.web.embedded.spring.MimeMappings
- All Implemented Interfaces:
Iterable<MimeMappings.Mapping>
This class represents a mapping of file extensions to MIME types.
It provides methods to add, retrieve, and remove mappings.
- Version:
- 1.0
- Author:
- Dr. Jalal H. Kiswani
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final class
This class represents a single mapping of a file extension to a MIME type. -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionThis method constructs a newMimeMappings
which is empty.MimeMappings
(MimeMappings mappings) This method constructs a newMimeMappings
which is mutable by default.MimeMappings
(Map<String, String> mappings) This method constructs a newMimeMappings
. -
Method Summary
Modifier and TypeMethodDescriptionThis method adds a mapping entry with the provided extension and MIME type.boolean
This method retrieves the MIME type associated with the specified file extension.getAll()
This method gets all the MIME types, in the mime-mapping.int
hashCode()
iterator()
This method removes a mapping for the specified file extension.static MimeMappings
unmodifiableMappings
(MimeMappings mappings) This method constructs a new with the provided mime-mappings that cannot be changed.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
DEFAULT
Represents the default mime-mapping.
-
-
Constructor Details
-
MimeMappings
public MimeMappings()This method constructs a newMimeMappings
which is empty. -
MimeMappings
This method constructs a newMimeMappings
which is mutable by default.- Parameters:
mappings
- Specifies the mappings to be added to this instance.
-
MimeMappings
This method constructs a newMimeMappings
.- Parameters:
mappings
- Specifies the mappings to be added to this instance.
-
-
Method Details
-
iterator
- Specified by:
iterator
in interfaceIterable<MimeMappings.Mapping>
-
getAll
This method gets all the MIME types, in the mime-mapping.- Returns:
- the MIME types, in the mime-mapping.
-
add
This method adds a mapping entry with the provided extension and MIME type.- Parameters:
extension
- Specifies the file extension.mimeType
- Specifies the MIME type associated with the extension.- Returns:
- the Mapping of the new MIME type.
-
get
This method retrieves the MIME type associated with the specified file extension.- Parameters:
extension
- Specifies the file extension.- Returns:
- the MIME type associated with the extension, or null if no mapping was found.
-
remove
This method removes a mapping for the specified file extension.- Parameters:
extension
- Specifies the file extension to remove the mapping for.- Returns:
- the MIME type that was previously associated with the extension, or null if no mapping was found.
-
hashCode
public int hashCode() -
equals
-
unmodifiableMappings
This method constructs a new with the provided mime-mappings that cannot be changed.- Parameters:
mappings
- Specifies the mime-mappings in the new instance.- Returns:
- the instance of
MimeMappings
that contains the provided mime-mappings.
-