Package com.sun.mail.iap

## Class Argument

- java.lang.Object
- - com.sun.mail.iap.Argument

    public class Argument
    extends java.lang.Object

Author:
  John Mani, Bill Shannon

### Field Summary

Fields
`protected java.util.List<java.lang.Object>` `items`

### Constructor Summary

Constructors
`Argument()` Constructor

### Method Summary

All Methods Instance Methods Concrete Methods
`Argument` `append​(Argument arg)` Append the given Argument to this Argument.
`void` `write​(Protocol protocol)`
`Argument` `writeArgument​(Argument c)` Write out as parenthesised list.
`Argument` `writeAtom​(java.lang.String s)` Write out given string as an Atom.
`Argument` `writeBytes​(byte[] b)` Write out given byte[] as a Literal.
`Argument` `writeBytes​(Literal b)` Write out given data as a literal.
`Argument` `writeBytes​(java.io.ByteArrayOutputStream b)` Write out given ByteArrayOutputStream as a Literal.
`Argument` `writeNString​(java.lang.String s)` Write out given string as an NSTRING, depending on the type of the characters inside the string.
`Argument` `writeNString​(java.lang.String s, java.lang.String charset)` Convert the given string into bytes in the specified charset, and write the bytes out as an NSTRING
`Argument` `writeNString​(java.lang.String s, java.nio.charset.Charset charset)` Convert the given string into bytes in the specified charset, and write the bytes out as an NSTRING
`Argument` `writeNumber​(int i)` Write out number.
`Argument` `writeNumber​(long i)` Write out number.
`Argument` `writeString​(java.lang.String s)` Write out given string as an ASTRING, depending on the type of the characters inside the string.
`Argument` `writeString​(java.lang.String s, java.lang.String charset)` Convert the given string into bytes in the specified charset, and write the bytes out as an ASTRING
`Argument` `writeString​(java.lang.String s, java.nio.charset.Charset charset)` Convert the given string into bytes in the specified charset, and write the bytes out as an ASTRING

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

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

### Field Detail

#### items

    protected java.util.List<java.lang.Object> items

### Constructor Detail

#### Argument

    public Argument()

Constructor

### Method Detail

#### append

    public Argument append​(Argument arg)

Append the given Argument to this Argument. All items from the source argument are copied into this destination argument.

Parameters:
  `arg` - the Argument to append
Returns:
  this

#### writeString

    public Argument writeString​(java.lang.String s)

Write out given string as an ASTRING, depending on the type of the characters inside the string. The string should contain only ASCII characters.

XXX: Hmm .. this should really be called writeASCII()

Parameters:
  `s` - String to write out
Returns:
  this

#### writeString

    public Argument writeString​(java.lang.String s,
                                java.lang.String charset)
                         throws java.io.UnsupportedEncodingException

Convert the given string into bytes in the specified charset, and write the bytes out as an ASTRING

Parameters:
  `s` - String to write out
  `charset` - the charset
Returns:
  this
Throws:
  `java.io.UnsupportedEncodingException` - for bad charset

#### writeString

    public Argument writeString​(java.lang.String s,
                                java.nio.charset.Charset charset)

Convert the given string into bytes in the specified charset, and write the bytes out as an ASTRING

Parameters:
  `s` - String to write out
  `charset` - the charset
Returns:
  this
Since:
  JavaMail 1.6.0

#### writeNString

    public Argument writeNString​(java.lang.String s)

Write out given string as an NSTRING, depending on the type of the characters inside the string. The string should contain only ASCII characters.

Parameters:
  `s` - String to write out
Returns:
  this
Since:
  JavaMail 1.5.1

#### writeNString

    public Argument writeNString​(java.lang.String s,
                                 java.lang.String charset)
                          throws java.io.UnsupportedEncodingException

Convert the given string into bytes in the specified charset, and write the bytes out as an NSTRING

Parameters:
  `s` - String to write out
  `charset` - the charset
Returns:
  this
Throws:
  `java.io.UnsupportedEncodingException` - for bad charset
Since:
  JavaMail 1.5.1

#### writeNString

    public Argument writeNString​(java.lang.String s,
                                 java.nio.charset.Charset charset)

Convert the given string into bytes in the specified charset, and write the bytes out as an NSTRING

Parameters:
  `s` - String to write out
  `charset` - the charset
Returns:
  this
Since:
  JavaMail 1.6.0

#### writeBytes

    public Argument writeBytes​(byte[] b)

Write out given byte[] as a Literal.

Parameters:
  `b` - byte[] to write out
Returns:
  this

#### writeBytes

    public Argument writeBytes​(java.io.ByteArrayOutputStream b)

Write out given ByteArrayOutputStream as a Literal.

Parameters:
  `b` - ByteArrayOutputStream to be written out.
Returns:
  this

#### writeBytes

    public Argument writeBytes​(Literal b)

Write out given data as a literal.

Parameters:
  `b` - Literal representing data to be written out.
Returns:
  this

#### writeAtom

    public Argument writeAtom​(java.lang.String s)

Write out given string as an Atom. Note that an Atom can contain only certain US-ASCII characters. No validation is done on the characters in the string.

Parameters:
  `s` - String
Returns:
  this

#### writeNumber

    public Argument writeNumber​(int i)

Write out number.

Parameters:
  `i` - number
Returns:
  this

#### writeNumber

    public Argument writeNumber​(long i)

Write out number.

Parameters:
  `i` - number
Returns:
  this

#### writeArgument

    public Argument writeArgument​(Argument c)

Write out as parenthesised list.

Parameters:
  `c` - the Argument
Returns:
  this

#### write

    public void write​(Protocol protocol)
               throws java.io.IOException,
                      ProtocolException

Throws:
  `java.io.IOException`
  `ProtocolException`