Package com.helger.commons.mime
Interface IMimeType
-
- All Superinterfaces:
ICloneable<IMimeType>
- All Known Implementing Classes:
MimeType
@MustImplementEqualsAndHashcode @MustImplementComparable public interface IMimeType extends ICloneable<IMimeType>
Interface for the structured representation of a single MIME type.- Author:
- Philip Helger
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description ICommonsList<MimeTypeParameter>getAllParameters()default StringgetAsString()Get the MIME type including all parameters as a single string.StringgetAsString(EMimeQuoting eQuotingAlgorithm)Get the MIME type including all parameters as a single string.StringgetAsStringWithoutParameters()StringgetContentSubType()EMimeContentTypegetContentType()IMimeTypegetCopyWithoutParameters()MimeTypeParametergetParameterAtIndex(int nIndex)Get the parameter at the specified index.intgetParameterCount()StringgetParametersAsString(EMimeQuoting eQuotingAlgorithm)Get all MIME type parameters as a single string but without the leading content and sub type.StringgetParameterValueWithName(String sParamName)Get the value of the parameter with the specified name.MimeTypeParametergetParameterWithName(String sParamName)Get the parameter with the specified name.booleanhasAnyParameters()default booleanhasParameterWithName(String sParamName)Check if a parameter with the specified name is present.-
Methods inherited from interface com.helger.commons.lang.ICloneable
getClone
-
-
-
-
Method Detail
-
getContentType
@Nonnull EMimeContentType getContentType()
- Returns:
- The content type. Never
null.
-
getAsString
@Nonnull default String getAsString()
Get the MIME type including all parameters as a single string. By default theCMimeType.DEFAULT_QUOTINGquoting algorithm is used.- Returns:
- The combined string to be used as text representation:
contentType '/' subType ( ';' parameterName '=' parameterValue )* - See Also:
getAsString(EMimeQuoting),getAsStringWithoutParameters()
-
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(),getParametersAsString(EMimeQuoting)
-
getAsStringWithoutParameters
@Nonnull @Nonempty String getAsStringWithoutParameters()
- Returns:
- The combined string to be used as text representation but without
the parameters:
contentType '/' subType - See Also:
getAsString()
-
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:
getAsString(EMimeQuoting),getAsStringWithoutParameters()
-
hasAnyParameters
boolean hasAnyParameters()
- Returns:
trueif at least one parameter is present,falseif no parameter is present.
-
getParameterCount
@Nonnegative int getParameterCount()
- Returns:
- The number of parameters. Alway ≥ 0.
-
getAllParameters
@Nonnull @ReturnsMutableCopy ICommonsList<MimeTypeParameter> getAllParameters()
- Returns:
- All present parameters. May not be
nullbut 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:
nullif 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 benull.- Returns:
trueif 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 benull.- Returns:
nullif 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 benull.- Returns:
nullif no such parameter exists.
-
-