public class

Response

extends Object
java.lang.Object
   ↳ com.google.code.com.sun.mail.iap.Response
Known Direct Subclasses
Known Indirect Subclasses

Class Overview

This class represents a response obtained from the input stream of an IMAP server.

Summary

Constants
int BAD
int BYE
int CONTINUATION
int NO
int OK
int SYNTHETIC
int TAGGED
int TAG_MASK
int TYPE_MASK
int UNTAGGED
int increment
Fields
protected byte[] buffer
protected int index
protected int pindex
protected int size
protected String tag
protected int type
Public Constructors
Response(String s)
Response(Protocol p)
Read a new Response from the given Protocol
Response(Response r)
Copy constructor.
Public Methods
static Response byeResponse(Exception ex)
Return a Response object that looks like a BYE protocol response.
String getRest()
Return the rest of the response as a string, usually used to return the arbitrary message text after a NO response.
String getTag()
Return the tag, if this is a tagged statement.
int getType()
boolean isBAD()
boolean isBYE()
boolean isContinuation()
boolean isNO()
boolean isOK()
boolean isSynthetic()
boolean isTagged()
boolean isUnTagged()
byte peekByte()
String readAtom(char delim)
Extract an ATOM, but stop at the additional delimiter (if not NUL).
String readAtom()
Extract an ATOM, starting at the current position.
String readAtomString()
Extract an ASTRING, starting at the current position and return as a String.
byte readByte()
Return the next byte from this Statement.
ByteArray readByteArray()
Extract a NSTRING, starting at the current position.
ByteArrayInputStream readBytes()
Extract a NSTRING, starting at the current position.
long readLong()
Extract a long number, starting at the current position.
int readNumber()
Extract an integer, starting at the current position.
String readString(char delim)
Read a string as an arbitrary sequence of characters, stopping at the delimiter Used to read part of a response code inside [].
String readString()
Extract a NSTRING, starting at the current position.
String[] readStringList()
void reset()
Reset pointer to beginning of response.
void skip(int count)
void skipSpaces()
void skipToken()
Skip to the next space, for use in error recovery while parsing.
String toString()
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final int BAD

Constant Value: 12 (0x0000000c)

public static final int BYE

Constant Value: 16 (0x00000010)

public static final int CONTINUATION

Constant Value: 1 (0x00000001)

public static final int NO

Constant Value: 8 (0x00000008)

public static final int OK

Constant Value: 4 (0x00000004)

public static final int SYNTHETIC

Constant Value: 32 (0x00000020)

public static final int TAGGED

Constant Value: 2 (0x00000002)

public static final int TAG_MASK

Constant Value: 3 (0x00000003)

public static final int TYPE_MASK

Constant Value: 28 (0x0000001c)

public static final int UNTAGGED

Constant Value: 3 (0x00000003)

private static final int increment

Constant Value: 100 (0x00000064)

Fields

protected byte[] buffer

protected int index

protected int pindex

protected int size

protected String tag

protected int type

Public Constructors

public Response (String s)

Parameters
s

public Response (Protocol p)

Read a new Response from the given Protocol

Parameters
p The Protocol object
Throws
IOException
ProtocolException

public Response (Response r)

Copy constructor.

Parameters
r

Public Methods

public static Response byeResponse (Exception ex)

Return a Response object that looks like a BYE protocol response. Include the details of the exception in the response string.

Parameters
ex

public String getRest ()

Return the rest of the response as a string, usually used to return the arbitrary message text after a NO response.

public String getTag ()

Return the tag, if this is a tagged statement.

Returns
  • tag of this tagged statement

public int getType ()

public boolean isBAD ()

public boolean isBYE ()

public boolean isContinuation ()

public boolean isNO ()

public boolean isOK ()

public boolean isSynthetic ()

public boolean isTagged ()

public boolean isUnTagged ()

public byte peekByte ()

public String readAtom (char delim)

Extract an ATOM, but stop at the additional delimiter (if not NUL). Used to parse a response code inside [].

Parameters
delim

public String readAtom ()

Extract an ATOM, starting at the current position. Updates the internal index to beyond the Atom.

Returns
  • an Atom

public String readAtomString ()

Extract an ASTRING, starting at the current position and return as a String. An ASTRING can be a QuotedString, a Literal or an Atom Any errors in parsing returns null ASTRING := QuotedString | Literal | Atom

Returns
  • a String

public byte readByte ()

Return the next byte from this Statement.

Returns
  • the next byte.

public ByteArray readByteArray ()

Extract a NSTRING, starting at the current position. Return it as a ByteArray. The sequence 'NIL' is returned as null NSTRING := QuotedString | Literal | "NIL"

Returns
  • a ByteArray

public ByteArrayInputStream readBytes ()

Extract a NSTRING, starting at the current position. Return it as a ByteArrayInputStream. The sequence 'NIL' is returned as null NSTRING := QuotedString | Literal | "NIL"

Returns
  • a ByteArrayInputStream

public long readLong ()

Extract a long number, starting at the current position. Updates the internal index to beyond the number. Returns -1 if a long number was not found.

Returns
  • a long

public int readNumber ()

Extract an integer, starting at the current position. Updates the internal index to beyond the number. Returns -1 if a number was not found.

Returns
  • a number

public String readString (char delim)

Read a string as an arbitrary sequence of characters, stopping at the delimiter Used to read part of a response code inside [].

Parameters
delim

public String readString ()

Extract a NSTRING, starting at the current position. Return it as a String. The sequence 'NIL' is returned as null NSTRING := QuotedString | Literal | "NIL"

Returns
  • a String

public String[] readStringList ()

public void reset ()

Reset pointer to beginning of response.

public void skip (int count)

Parameters
count

public void skipSpaces ()

public void skipToken ()

Skip to the next space, for use in error recovery while parsing.

public String toString ()