## org.w3c.jigsaw.forms
Class URLDecoder

    java.lang.Object
      |
      +--org.w3c.jigsaw.forms.URLDecoder

public class URLDecoder
extends java.lang.Object

Form data decoder. This class takes an InputStream and decodes it in compliance to the application/x-www-form-urlencoded MIME type.

Field Summary
`static java.lang.String` `EMPTY_VALUE`

Constructor Summary
`URLDecoder(java.io.InputStream in)` Create an URLDecoder for the given stream.
`URLDecoder(java.io.InputStream in, boolean overide)` Create an URLDecoder for the given stream.
`URLDecoder(java.io.Reader in)` Create an URLDecoder for the given stream.
`URLDecoder(java.io.Reader in, boolean overide)` Create an URLDecoder for the given stream.

Method Summary
`protected void` `addVariable(java.lang.String var, java.lang.String val)` Define a new variable in this data set.
`java.lang.String[]` `getMultipleValues(java.lang.String name)` Get the values of the variable, as an array.
`java.lang.String` `getValue(java.lang.String name)` Get the value of a variable.
`java.util.Enumeration` `keys()` Get an enumeration of the variable names.
`java.util.Hashtable` `parse()` Parse our input stream following the application/x-www-form-urlencoded specification.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### EMPTY_VALUE

    public static final java.lang.String EMPTY_VALUE

Constructor Detail

### URLDecoder

    public URLDecoder(java.io.Reader in,
                      boolean overide)

  Create an URLDecoder for the given stream.
  Parameters:
    `in` - The input stream to be parsed.
    `list` - Tells how to handle multiple settings of the same variable. When false, mutiple settings to the same variable will accumulate the value into an array, returned by getValue(). Otherwise, the last assignment will overide any previous assignment.

### URLDecoder

    public URLDecoder(java.io.Reader in)

  Create an URLDecoder for the given stream.
  Parameters:
    `in` - The input stream to be parsed.
    `list` - Tells how to handle multiple settings of the same variable. When false, mutiple settings to the same variable will accumulate the value into an array, returned by getValue(). Otherwise, the last assignment will overide any previous assignment.

### URLDecoder

    public URLDecoder(java.io.InputStream in,
                      boolean overide)

  Create an URLDecoder for the given stream.
  Parameters:
    `in` - The input stream to be parsed.
    `list` - Tells how to handle multiple settings of the same variable. When false, mutiple settings to the same variable will accumulate the value into an array, returned by getValue(). Otherwise, the last assignment will overide any previous assignment.

### URLDecoder

    public URLDecoder(java.io.InputStream in)

  Create an URLDecoder for the given stream. Default constructor, which will keep track only of the last setting of the same variable (if ever it gets assigned multiply).
  Parameters:
    `in` - The input stream to be parsed.

Method Detail

### keys

    public java.util.Enumeration keys()

  Get an enumeration of the variable names.
  Returns:
    An enumeration continaing one element per key.

### addVariable

    protected void addVariable(java.lang.String var,
                               java.lang.String val)

  Define a new variable in this data set.
  Parameters:
    `name` - The name of the variable.
    `value` - Its value.

### getMultipleValues

    public java.lang.String[] getMultipleValues(java.lang.String name)

  Get the values of the variable, as an array. Use this method when you have turned off the overide flag in the constructor of this object. This will always return either an array of Strings or null.

  I use this in the PICS label bureau, and I pretty sure this is not a good reason to have it here.

  Parameters:
    `name` - The name of the variable to look for.
  Returns:
    An String[] having one entry per variable's value, or null if none was found.

### getValue

    public java.lang.String getValue(java.lang.String name)

  Get the value of a variable. If you have allowed the decoder to accumulate multiple values for the same variable, this method casts of the value to a String may fail at runtime.
  Parameters:
    `name` - The name of the variable whose value is to be fetched.
  Returns:
    Its values, which is always provided as a String, or null.

### parse

    public java.util.Hashtable parse()
                              throws java.io.IOException,
                                     URLDecoderException

  Parse our input stream following the application/x-www-form-urlencoded specification.
  Returns:
    The raw bindings obtained from parsing the stream, as a Hashtable instance.
  Throws:
    java.io.IOException - When IO error occurs while reading the stream.
    URLDecoderException - If the format is invalid.