Package ch.raffael.meldioc.library.codec
Class ContentType
java.lang.Object
ch.raffael.meldioc.library.codec.ContentType
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionaddCharsetAttribute(Charset charset) static ContentType.Builderbuilder()io.vavr.control.Option<Charset>charset()static ContentTypecss()booleanequalsTypeOnly(ContentType that) static ContentTypehtml()static ContentTypestatic ContentTypejpeg()static ContentTypejson()static ContentTypestatic ContentTypeParses the given content type, use for hardcoded types.static ContentTypestatic ContentTypestatic ContentTypestatic ContentTypepng()render()render(StringBuilder buf) abstract Stringsubtype()static ContentTypeabstract Stringtype()withAttributes(io.vavr.collection.Map<String, String> value) Copy the current immutable object by setting a value for theattributesattribute.withDefaultCharset(Charset charset) withSubtype(String value) Copy the current immutable object by setting a value for thesubtypeattribute.Copy the current immutable object by setting a value for thetypeattribute.static ContentTypexhtml()static ContentTypexml()
-
Method Details
-
builder
-
of
-
of
public static ContentType of(String type, String subtype, io.vavr.collection.Map<String, String> attributes) -
of
Parses the given content type, use for hardcoded types. This method throws anIllegalArgumentExceptionif the given content type cannot be parsed. If a syntax error is to be expected, e.g. because it's being parsed from user input, useContentTypes.parseContentType(String)instead.- See Also:
-
type
-
subtype
-
attributes
-
withoutAttributes
-
addCharsetAttribute
-
withDefaultCharset
-
charset
-
charset
-
equalsTypeOnly
-
render
-
render
-
xml
-
json
-
html
-
xhtml
-
javascript
-
css
-
plainText
-
octetStream
-
png
-
jpeg
-
tentativeYaml
-
withType
Copy the current immutable object by setting a value for thetypeattribute. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for type- Returns:
- A modified copy of the
thisobject
-
withSubtype
Copy the current immutable object by setting a value for thesubtypeattribute. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for subtype- Returns:
- A modified copy of the
thisobject
-
withAttributes
Copy the current immutable object by setting a value for theattributesattribute. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for attributes- Returns:
- A modified copy of the
thisobject
-