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
Modifier and TypeMethodDescriptiondefault StringGet the MIME type including all parameters as a single string.getAsString(EMimeQuoting eQuotingAlgorithm) Get the MIME type including all parameters as a single string.getParameterAtIndex(int nIndex) Get the parameter at the specified index.intgetParametersAsString(EMimeQuoting eQuotingAlgorithm) Get all MIME type parameters as a single string but without the leading content and sub type.getParameterValueWithName(String sParamName) Get the value of the parameter with the specified name.getParameterWithName(String sParamName) Get the parameter with the specified name.booleandefault booleanhasParameterWithName(String sParamName) Check if a parameter with the specified name is present.Methods inherited from interface com.helger.commons.lang.ICloneable
getClone
-
Method Details
-
getContentType
- Returns:
- The content type. Never
null.
-
getContentSubType
- Returns:
- The content sub type. Never
null.
-
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
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
- Returns:
- The combined string to be used as text representation but without
the parameters:
contentType '/' subType - See Also:
-
getParametersAsString
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:
trueif at least one parameter is present,falseif no parameter is present.
-
getParameterCount
- Returns:
- The number of parameters. Alway ≥ 0.
-
getAllParameters
- Returns:
- All present parameters. May not be
nullbut empty.
-
getParameterAtIndex
Get the parameter at the specified index.- Parameters:
nIndex- The index to use. Should be ≥ 0.- Returns:
nullif the provided index is illegal.
-
hasParameterWithName
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
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
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.
-
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.
-