Class ContentType

java.lang.Object
ch.raffael.meldioc.library.codec.ContentType

public abstract class ContentType extends Object
  • Method Details

    • builder

      public static ContentType.Builder builder()
    • of

      public static ContentType of(String type, String subtype)
    • of

      public static ContentType of(String type, String subtype, io.vavr.collection.Map<String,String> attributes)
    • of

      public static ContentType of(String contentType)
      Parses the given content type, use for hardcoded types. This method throws an IllegalArgumentException if 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, use ContentTypes.parseContentType(String) instead.
      See Also:
    • type

      @Parameter public abstract String type()
    • subtype

      @Parameter public abstract String subtype()
    • attributes

      @Parameter public abstract io.vavr.collection.Map<String,String> attributes()
    • withoutAttributes

      public ContentType withoutAttributes()
    • addCharsetAttribute

      public ContentType addCharsetAttribute(Charset charset)
    • withDefaultCharset

      public ContentType withDefaultCharset(Charset charset)
    • charset

      @Lazy public io.vavr.control.Option<Charset> charset()
    • charset

      public Charset charset(Charset fallback)
    • equalsTypeOnly

      public boolean equalsTypeOnly(ContentType that)
    • render

      public String render()
    • render

      public StringBuilder render(StringBuilder buf)
    • xml

      public static ContentType xml()
    • json

      public static ContentType json()
    • html

      public static ContentType html()
    • xhtml

      public static ContentType xhtml()
    • javascript

      public static ContentType javascript()
    • css

      public static ContentType css()
    • plainText

      public static ContentType plainText()
    • octetStream

      public static ContentType octetStream()
    • png

      public static ContentType png()
    • jpeg

      public static ContentType jpeg()
    • tentativeYaml

      public static ContentType tentativeYaml()
    • withType

      ContentType withType(String value)
      Copy the current immutable object by setting a value for the type attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for type
      Returns:
      A modified copy of the this object
    • withSubtype

      ContentType withSubtype(String value)
      Copy the current immutable object by setting a value for the subtype attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for subtype
      Returns:
      A modified copy of the this object
    • withAttributes

      ContentType withAttributes(io.vavr.collection.Map<String,String> value)
      Copy the current immutable object by setting a value for the attributes attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for attributes
      Returns:
      A modified copy of the this object