Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.w3c.www.mime
Class LanguageTag

    java.lang.Object
      |
      +--org.w3c.www.mime.LanguageTag

public class LanguageTag
extends java.lang.Object
implements java.io.Serializable, java.lang.Cloneable

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

See Also:
  Serialized Form

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

### NO_MATCH

    public static int NO_MATCH

### MATCH_LANGUAGE

    public static int MATCH_LANGUAGE

### MATCH_SPECIFIC_LANGUAGE

    public static int MATCH_SPECIFIC_LANGUAGE

### MATCH_SUBTAG

    public static int MATCH_SUBTAG

### MATCH_SPECIFIC_SUBTAG

    public static int MATCH_SPECIFIC_SUBTAG

### language

    protected java.lang.String language

  String representation of the language

### subtag

    protected java.lang.String subtag

  String representation of subtag

### external

    protected java.lang.String external

  external form of this language tag

Constructor Detail

### LanguageTag

    public LanguageTag(java.lang.String spec)

  Construct a Language tag from a spec

### LanguageTag

    public LanguageTag(java.lang.String language,
                       java.lang.String subtag)

  construct directly a language tag it NEEDS both language and subtype parameters

Method Detail

### match

    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.
  Parameters:
    `other` - The other LanguageTag to match against ourself.

### toString

    public java.lang.String toString()

  A printable representation of this LanguageTag. The printed representation is guaranteed to be parseable by the String constructor.
  Overrides:
    toString in class java.lang.Object

### getLanguage

    public java.lang.String getLanguage()

  Get the language
  Returns:
    The language, encoded as a String.

### getSubtag

    public java.lang.String getSubtag()

  Get the subtag
  Returns:
    The subtag, encoded as a string

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD