| java.lang.Object org.w3c.www.mime.LanguageTag
LanguageTag | public class LanguageTag implements Serializable,Cloneable(Code) | | This class is used to represent parsed Language tags,
It creates a representation from a string based representation
of the Language tag, as defined in RFC 1766
NOTE, we don't check that languages are defined according to ISO 639
|
Method Summary | |
public String | getLanguage() | public String | getSubtag() | public int | match(LanguageTag other) How good the given LanguageTag matches the receiver of the method ?
This method returns a matching level among:
- NO_MATCH
- Language not matching,
- MATCH_LANGUAGE
- Languages match roughly (with *),
- MATCH_SPECIFIC_LANGUAGE
- Languages match exactly,
- MATCH_SUBTAG
- Languages match, subtags matches roughly
- MATCH_SPECIFIC_SUBAG
- Languages match, subtag matches exactly
The matches are ranked from worst match to best match, a simple
Max ( match[i], matched) will give the best match. | public String | toString() A printable representation of this LanguageTag. |
MATCH_LANGUAGE | public static int MATCH_LANGUAGE(Code) | | |
MATCH_SPECIFIC_LANGUAGE | public static int MATCH_SPECIFIC_LANGUAGE(Code) | | |
MATCH_SPECIFIC_SUBTAG | public static int MATCH_SPECIFIC_SUBTAG(Code) | | |
MATCH_SUBTAG | public static int MATCH_SUBTAG(Code) | | |
NO_MATCH | public static int NO_MATCH(Code) | | |
external | protected String external(Code) | | external form of this language tag
|
language | protected String language(Code) | | String representation of the language
|
subtag | protected String subtag(Code) | | String representation of subtag
|
LanguageTag | public LanguageTag(String spec)(Code) | | Construct a Language tag from a spec
|
LanguageTag | public LanguageTag(String language, String subtag)(Code) | | construct directly a language tag
it NEEDS both language and subtype parameters
|
getLanguage | public String getLanguage()(Code) | | Get the language
The language, encoded as a String. |
getSubtag | public String getSubtag()(Code) | | Get the subtag
The subtag, encoded as a string |
match | public int match(LanguageTag other)(Code) | | How good the given LanguageTag matches the receiver of the method ?
This method returns a matching level among:
- NO_MATCH
- Language not matching,
- MATCH_LANGUAGE
- Languages match roughly (with *),
- MATCH_SPECIFIC_LANGUAGE
- Languages match exactly,
- MATCH_SUBTAG
- Languages match, subtags matches roughly
- MATCH_SPECIFIC_SUBAG
- Languages match, subtag matches exactly
The matches are ranked from worst match to best match, a simple
Max ( match[i], matched) will give the best match.
Parameters: other - The other LanguageTag to match against ourself. |
toString | public String toString()(Code) | | A printable representation of this LanguageTag.
The printed representation is guaranteed to be parseable by the
String constructor.
|
|
|