public class Response
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private static java.lang.String |
ASTRING_CHAR_DELIM
An ASTRING_CHAR is any CHAR delimited by:
SPACE | CTL | '(' | ')' | '{' | '%' | '*' | '"' | '\'
(CTL is handled in readDelimString.)
|
private static java.lang.String |
ATOM_CHAR_DELIM
An ATOM is any CHAR delimited by:
SPACE | CTL | '(' | ')' | '{' | '%' | '*' | '"' | '\' | ']'
(CTL is handled in readDelimString.)
|
static int |
BAD |
protected byte[] |
buffer |
static int |
BYE |
static int |
CONTINUATION |
private static int |
increment |
protected int |
index |
static int |
NO |
static int |
OK |
protected int |
pindex |
protected int |
size |
static int |
SYNTHETIC |
protected java.lang.String |
tag |
static int |
TAG_MASK |
static int |
TAGGED |
protected int |
type |
static int |
TYPE_MASK |
static int |
UNTAGGED |
Constructor and Description |
---|
Response(Protocol p)
Read a new Response from the given Protocol
|
Response(Response r)
Copy constructor.
|
Response(java.lang.String s) |
Modifier and Type | Method and Description |
---|---|
static Response |
byeResponse(java.lang.Exception ex)
Return a Response object that looks like a BYE protocol response.
|
java.lang.String |
getRest()
Return the rest of the response as a string, usually used to
return the arbitrary message text after a NO response.
|
java.lang.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() |
private void |
parse() |
private java.lang.Object |
parseString(boolean parseAtoms,
boolean returnString)
Generic parsing routine that can parse out a Quoted-String,
Literal or Atom and return the parsed token as a String
or a ByteArray.
|
byte |
peekByte() |
java.lang.String |
readAtom()
Extract an ATOM, starting at the current position.
|
java.lang.String |
readAtomString()
Extract an ASTRING, starting at the current position
and return as a String.
|
java.lang.String[] |
readAtomStringList() |
byte |
readByte()
Return the next byte from this Statement.
|
ByteArray |
readByteArray()
Extract a NSTRING, starting at the current position.
|
java.io.ByteArrayInputStream |
readBytes()
Extract a NSTRING, starting at the current position.
|
private java.lang.String |
readDelimString(java.lang.String delim)
Extract a string stopping at control characters or any
character in delim.
|
long |
readLong()
Extract a long number, starting at the current position.
|
int |
readNumber()
Extract an integer, starting at the current position.
|
java.lang.String |
readString()
Extract a NSTRING, starting at the current position.
|
java.lang.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 [].
|
java.lang.String[] |
readStringList() |
private java.lang.String[] |
readStringList(boolean atom) |
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.
|
java.lang.String |
toString() |
protected int index
protected int pindex
protected int size
protected byte[] buffer
protected int type
protected java.lang.String tag
private static final int increment
public static final int TAG_MASK
public static final int CONTINUATION
public static final int TAGGED
public static final int UNTAGGED
public static final int TYPE_MASK
public static final int OK
public static final int NO
public static final int BAD
public static final int BYE
public static final int SYNTHETIC
private static java.lang.String ATOM_CHAR_DELIM
private static java.lang.String ASTRING_CHAR_DELIM
public Response(java.lang.String s)
public Response(Protocol p) throws java.io.IOException, ProtocolException
p
- the Protocol objectjava.io.IOException
ProtocolException
public Response(Response r)
public static Response byeResponse(java.lang.Exception ex)
private void parse()
public void skipSpaces()
public void skipToken()
public void skip(int count)
public byte peekByte()
public byte readByte()
public java.lang.String readAtom()
private java.lang.String readDelimString(java.lang.String delim)
public java.lang.String readString(char delim)
public java.lang.String[] readStringList()
public java.lang.String[] readAtomStringList()
private java.lang.String[] readStringList(boolean atom)
public int readNumber()
public long readLong()
public java.lang.String readString()
public java.io.ByteArrayInputStream readBytes()
public ByteArray readByteArray()
public java.lang.String readAtomString()
private java.lang.Object parseString(boolean parseAtoms, boolean returnString)
public int getType()
public boolean isContinuation()
public boolean isTagged()
public boolean isUnTagged()
public boolean isOK()
public boolean isNO()
public boolean isBAD()
public boolean isBYE()
public boolean isSynthetic()
public java.lang.String getTag()
public java.lang.String getRest()
public void reset()
public java.lang.String toString()
toString
in class java.lang.Object