Class DataURLs.Builder.WithMediaType
- java.lang.Object
-
- com.github.robtimus.net.protocol.data.DataURLs.Builder.WithMediaType
-
- Enclosing class:
- DataURLs.Builder
public static final class DataURLs.Builder.WithMediaType extends java.lang.ObjectA class that can be used to build data URLs with media types.
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.StringmimeTypeprivate java.util.Map<java.lang.String,java.lang.String>parametersprivate DataURLs.Builderparent
-
Constructor Summary
Constructors Modifier Constructor Description privateWithMediaType(DataURLs.Builder parent, MediaType mediaType)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.net.URLbuild()Creates a new data URL.DataURLs.Builder.WithMediaTypewithCharset(java.nio.charset.Charset charset)Sets the charset of the media type.DataURLs.Builder.WithMediaTypewithMediaTypeParameter(java.lang.String name, java.lang.String value)Sets the value for a media type parameter.
-
-
-
Field Detail
-
parent
private final DataURLs.Builder parent
-
mimeType
private final java.lang.String mimeType
-
parameters
private final java.util.Map<java.lang.String,java.lang.String> parameters
-
-
Constructor Detail
-
WithMediaType
private WithMediaType(DataURLs.Builder parent, MediaType mediaType)
-
-
Method Detail
-
withMediaTypeParameter
public DataURLs.Builder.WithMediaType withMediaTypeParameter(java.lang.String name, java.lang.String value)
Sets the value for a media type parameter.- Parameters:
name- The parameter name.value- The parameter value. Usenullto remove an existing parameter.- Returns:
- This builder object.
-
withCharset
public DataURLs.Builder.WithMediaType withCharset(java.nio.charset.Charset charset)
Sets the charset of the media type. This method is shorthand forwithMediaTypeParameter("charset", charset.name()).- Parameters:
charset- The charset.- Returns:
- This builder object.
- Throws:
java.lang.NullPointerException- If the charset isnull.
-
build
public java.net.URL build()
Creates a new data URL.- Returns:
- The created data URL.
-
-