|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.w3c.www.mime.LanguageTag
public class LanguageTag
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
Field Summary | |
---|---|
protected java.lang.String |
external
external form of this language tag |
protected java.lang.String |
language
String representation of the language |
static int |
MATCH_LANGUAGE
|
static int |
MATCH_SPECIFIC_LANGUAGE
|
static int |
MATCH_SPECIFIC_SUBTAG
|
static int |
MATCH_SUBTAG
|
static int |
NO_MATCH
|
protected java.lang.String |
subtag
String representation of subtag |
Constructor Summary | |
---|---|
LanguageTag(java.lang.String spec)
Construct a Language tag from a spec |
|
LanguageTag(java.lang.String language,
java.lang.String subtag)
construct directly a language tag it NEEDS both language and subtype parameters |
Method Summary | |
---|---|
java.lang.String |
getLanguage()
Get the language |
java.lang.String |
getSubtag()
Get the subtag |
int |
match(LanguageTag other)
How good the given LanguageTag matches the receiver of the method ? This method returns a matching level among: NO_MATCHLanguage not matching, MATCH_LANGUAGELanguages match roughly (with *), MATCH_SPECIFIC_LANGUAGELanguages match exactly, MATCH_SUBTAGLanguages match, subtags matches roughly MATCH_SPECIFIC_SUBAGLanguages 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. |
java.lang.String |
toString()
A printable representation of this LanguageTag. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static int NO_MATCH
public static int MATCH_LANGUAGE
public static int MATCH_SPECIFIC_LANGUAGE
public static int MATCH_SUBTAG
public static int MATCH_SPECIFIC_SUBTAG
protected java.lang.String language
protected java.lang.String subtag
protected java.lang.String external
Constructor Detail |
---|
public LanguageTag(java.lang.String spec)
public LanguageTag(java.lang.String language, java.lang.String subtag)
Method Detail |
---|
public int match(LanguageTag other)
other
- The other LanguageTag to match against ourself.public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String getLanguage()
public java.lang.String getSubtag()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |