Interface IMimeType

All Superinterfaces:
ICloneable<IMimeType>
All Known Implementing Classes:
MimeType

Interface for the structured representation of a single MIME type.
Author:
Philip Helger
  • Method Details

    • getContentType

      @Nonnull EMimeContentType getContentType()
      Returns:
      The content type. Never null.
    • getContentSubType

      @Nonnull String getContentSubType()
      Returns:
      The content sub type. Never null.
    • getAsString

      @Nonnull default String getAsString()
      Get the MIME type including all parameters as a single string. By default the CMimeType.DEFAULT_QUOTING quoting algorithm is used.
      Returns:
      The combined string to be used as text representation: contentType '/' subType ( ';' parameterName '=' parameterValue )*
      See Also:
    • getAsString

      @Nonnull @Nonempty String getAsString(@Nonnull EMimeQuoting eQuotingAlgorithm)
      Get the MIME type including all parameters as a single string. The specified quoting algorithm is used to quote parameter values (if necessary).
      Parameters:
      eQuotingAlgorithm - Quoting algorithm to be used
      Returns:
      The combined string to be used as text representation: contentType '/' subType ( ';' parameterName '=' parameterValue )*
      See Also:
    • getAsStringWithoutParameters

      @Nonnull @Nonempty String getAsStringWithoutParameters()
      Returns:
      The combined string to be used as text representation but without the parameters: contentType '/' subType
      See Also:
    • getParametersAsString

      @Nonnull String getParametersAsString(@Nonnull EMimeQuoting eQuotingAlgorithm)
      Get all MIME type parameters as a single string but without the leading content and sub type. The specified quoting algorithm is used to quote parameter values.
      Parameters:
      eQuotingAlgorithm - Quoting algorithm to be used
      Returns:
      The combined string to be used as text representation: (';' parameterName '=' parameterValue )* . If no parameters are present, an empty String is returned!
      See Also:
    • hasAnyParameters

      boolean hasAnyParameters()
      Returns:
      true if at least one parameter is present, false if no parameter is present.
    • getParameterCount

      @Nonnegative int getParameterCount()
      Returns:
      The number of parameters. Alway ≥ 0.
    • getAllParameters

      Returns:
      All present parameters. May not be null but empty.
    • getParameterAtIndex

      @Nullable MimeTypeParameter getParameterAtIndex(@Nonnegative int nIndex)
      Get the parameter at the specified index.
      Parameters:
      nIndex - The index to use. Should be ≥ 0.
      Returns:
      null if the provided index is illegal.
    • hasParameterWithName

      default boolean hasParameterWithName(@Nullable String sParamName)
      Check if a parameter with the specified name is present. The names are matched case sensitive!
      Parameters:
      sParamName - The parameter name to search. May be null.
      Returns:
      true if such a parameter exists.
    • getParameterWithName

      @Nullable MimeTypeParameter getParameterWithName(@Nullable String sParamName)
      Get the parameter with the specified name. The names are matched case sensitive!
      Parameters:
      sParamName - The parameter name to search. May be null.
      Returns:
      null if no such parameter exists.
    • getParameterValueWithName

      @Nullable String getParameterValueWithName(@Nullable String sParamName)
      Get the value of the parameter with the specified name. The names are matched case sensitive!
      Parameters:
      sParamName - The parameter name to search. May be null.
      Returns:
      null if no such parameter exists.
    • getCopyWithoutParameters

      @Nonnull IMimeType getCopyWithoutParameters()
      Returns:
      A copy of this MIME type but only the content type and the sub type. This method must even deliver a copy if no parameter are present! May not return null.