- java.lang.Object
-
- com.sun.mail.iap.Argument
-
public class Argument extends java.lang.Object
- Author:
- John Mani, Bill Shannon
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.List<java.lang.Object>
items
-
Constructor Summary
Constructors Constructor Description Argument()
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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 NSTRINGArgument
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 NSTRINGArgument
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 ASTRINGArgument
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
-
-
-
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 outcharset
- 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 outcharset
- 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 outcharset
- 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 outcharset
- 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
-
-