public static final class MimeMap.Builder extends Object
addMimeMapping(String, List) and addMimeMapping(String, String) to add
mapping entries and build final MimeMap with build().| Modifier and Type | Method and Description |
|---|---|
MimeMap.Builder |
addMimeMapping(String mimeSpec,
List<String> extensionSpecs)
Puts the mapping , and also the mappings
for each given extension.
|
MimeMap.Builder |
addMimeMapping(String mimeSpec,
String extensionSpec)
Convenience method.
|
MimeMap |
build()
Builds
MimeMap containing all added MIME mappings. |
String |
toString()
Returns a string containing a concise, human-readable description of this
object.
|
@NonNull public MimeMap.Builder addMimeMapping(@NonNull String mimeSpec, @NonNull List<String> extensionSpecs)
Map.putIfAbsent(K, V) semantics (
present) vs. Map.put(K, V) semantics (),
For example, put("text/html", "?htm", "html") would add the following
mappings:
put("?text/html", "?htm", "html") would have the same effect except
that an earlier mapping from MIME type "text/html" would not be
overwritten.mimeSpec - A MIME type carrying an optional prefix of "?". If present,
the "?" is stripped off and mapping for the resulting MIME
type is only added to the map if no mapping had yet existed for that
type.extensionSpecs - The extensions from which to add mappings back to
the "?" is stripped off and mapping for the resulting extension
is only added to the map if no mapping had yet existed for that
extension.
If extensionSpecs is empty, then calling this method has no
effect on the mapping that is being constructed.IllegalArgumentException - if mimeSpec or any of the extensionSpecs
are invalid (null, empty, contain ' ', or '?' after an initial '?' has
been stripped off).@NonNull public MimeMap.Builder addMimeMapping(@NonNull String mimeSpec, @NonNull String extensionSpec)
@NonNull public MimeMap build()
MimeMap containing all added MIME mappings.MimeMap containing previously added MIME mapping entriespublic String toString()
ObjectgetClass().getName() + '@' + Integer.toHexString(hashCode())
See Writing a useful
toString method
if you intend implementing your own toString method.