# Class LanguageParser

java.lang.Object
org.simpleframework.util.parse.Parser
org.simpleframework.http.parse.ListParser<Locale>
org.simpleframework.http.parse.LanguageParser

public class LanguageParser extends ListParser<Locale>
LanguageParser is used to parse the HTTP `Accept-Language` header. This takes in an `Accept-Language` header and parses it according the RFC 2616 BNF for the `Accept-Language` header. This also has the ability to sequence the language tokens in terms of the most preferred and the least preferred.

This uses the qvalues outlined by RFC 2616 to order the language tokens by preference. Typically the language tokens will not have qvalues with the language. However when a language tag has the qvalue parameter then this tag will be ordered based on the value of that parameter. A language tag without the qvalue parameter is considered to have a qvalue of 1 and is ordered accordingly.

Author:
  Niall Gallagher

## Field Summary

### Fields inherited from class Parser

`buf, count, off`

## Constructor Summary

Constructors
Constructor
Description
`LanguageParser()`
This is used to create a `LanguageParser` for the `Accept-Language` HTTP header value.
`LanguageParser(String text)`
This is used to create a `LanguageParser` for the `Accept-Language` HTTP header value.
`LanguageParser(List<String> list)`
This is used to create a `LanguageParser` for the `Accept-Language` HTTP header value.

## Method Summary

Modifier and Type
Method
Description
`protected Locale`
`create(char[] text, int start, int len)`
This creates a locale object using an offset and a length.

### Methods inherited from class ListParser

`init, list, parse, parse`

### Methods inherited from class Parser

`digit, ensureCapacity, parse, skip, space, toLower`

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### LanguageParser

public LanguageParser()
This is used to create a `LanguageParser` for the `Accept-Language` HTTP header value. This will parse a set of language tokens and there parameters. The languages will be ordered on preference. This constructor will parse the value given using `parse(String)`.

### LanguageParser

public LanguageParser(String text)
This is used to create a `LanguageParser` for the `Accept-Language` HTTP header value. This will parse a set of language tokens and there parameters. The languages will be ordered on preference. This constructor will parse the value given using `parse(String)`.

Parameters:
  `text` - value of a `Accept-Language` header

### LanguageParser

public LanguageParser(List<String> list)
This is used to create a `LanguageParser` for the `Accept-Language` HTTP header value. This will parse a set of language tokens and there parameters. The languages will be ordered on preference. This constructor will parse the value given using `parse(String)`.

Parameters:
  `list` - value of a `Accept-Language` header

## Method Details

### create

protected Locale create(char[] text, int start, int len)
This creates a locale object using an offset and a length. The locale is created from the extracted token and the offset and length ensure that no leading or trailing whitespace are within the created locale object.

Specified by:
  `create` in class `ListParser<Locale>`
Parameters:
  `text` - this is the text buffer to acquire the value from
  `start` - the offset within the array to take characters
  `len` - this is the number of characters within the token