org.restlet.engine.http.header

## Class CookieWriter

- java.lang.Object
- - java.io.Writer
  - - java.io.StringWriter
    - - org.restlet.engine.http.header.HeaderWriter<Cookie>
      - - org.restlet.engine.http.header.CookieWriter

All Implemented Interfaces:
  java.io.Closeable, java.io.Flushable, java.lang.Appendable, java.lang.AutoCloseable

    public class CookieWriter
    extends HeaderWriter<Cookie>

Cookie header writer.

Author:
  Jerome Louvel

### Field Summary

### Fields inherited from class java.io.Writer

`lock`

### Constructor Summary

Constructors
Constructor and Description
`CookieWriter()`

### Method Summary

Methods
`CookieWriter` `append(Cookie cookie)` Appends a value.
`CookieWriter` `append(java.util.List<Cookie> cookies)` Appends a list of cookies as an HTTP header.
`CookieWriter` `appendValue(java.lang.String value, int version)` Appends a source string as an HTTP comment.
`static void` `getCookies(java.util.List<Cookie> source, java.util.Map<java.lang.String,Cookie> destination)` Gets the cookies whose name is a key in the given map.
`static java.lang.String` `write(Cookie cookie)` Writes a cookie.
`static java.lang.String` `write(java.util.List<Cookie> cookies)` Writes a cookie.

### Methods inherited from class org.restlet.engine.http.header.HeaderWriter

`append, append, append, append, append, append, appendComment, appendExtension, appendExtension, appendParameterSeparator, appendProduct, appendQuotedPair, appendQuotedString, appendSpace, appendToken, appendUriEncoded, appendValueSeparator, canWrite`

### Methods inherited from class java.io.StringWriter

`append, close, flush, getBuffer, toString, write, write, write, write`

### Methods inherited from class java.io.Writer

`write`

### Methods inherited from class java.lang.Object

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

### Constructor Detail

#### CookieWriter

    public CookieWriter()

### Method Detail

#### getCookies

    public static void getCookies(java.util.List<Cookie> source,
                  java.util.Map<java.lang.String,Cookie> destination)

Gets the cookies whose name is a key in the given map. If a matching cookie is found, its value is put in the map.

Parameters:
  `source` - The source list of cookies.
  `destination` - The cookies map controlling the reading.

#### write

    public static java.lang.String write(Cookie cookie)
                                  throws java.lang.IllegalArgumentException

Writes a cookie.

Parameters:
  `cookie` - The cookie to format.
Returns:
  The formatted cookie.
Throws:
  `java.lang.IllegalArgumentException` - If the Cookie contains illegal values.

#### write

    public static java.lang.String write(java.util.List<Cookie> cookies)

Writes a cookie.

Parameters:
  `cookies` - The cookies to format.
Returns:
  The formatted cookie.

#### append

    public CookieWriter append(Cookie cookie)
                        throws java.lang.IllegalArgumentException

Description copied from class: `HeaderWriter`
Appends a value.

Specified by:
  `append` in class `HeaderWriter<Cookie>`
Parameters:
  `cookie` - The value.
Returns:
  This writer.
Throws:
  `java.lang.IllegalArgumentException`

#### append

    public CookieWriter append(java.util.List<Cookie> cookies)

Appends a list of cookies as an HTTP header.

Parameters:
  `cookies` - The list of cookies to format.
Returns:
  This writer.

#### appendValue

    public CookieWriter appendValue(java.lang.String value,
                           int version)

Appends a source string as an HTTP comment.

Parameters:
  `value` - The source string to format.
  `version` - The cookie version.
Returns:
  This writer.