public class Response extends Object
Modifier and Type | Field and Description |
---|---|
static int |
BAD |
protected byte[] |
buffer |
static int |
BYE |
static int |
CONTINUATION |
protected Exception |
ex |
protected int |
index |
static int |
NO |
static int |
OK |
protected int |
pindex |
protected int |
size |
static int |
SYNTHETIC |
protected String |
tag |
static int |
TAG_MASK |
static int |
TAGGED |
protected int |
type |
static int |
TYPE_MASK |
static int |
UNTAGGED |
protected boolean |
utf8 |
Constructor and Description |
---|
Response(Protocol p)
Read a new Response from the given Protocol
|
Response(Response r)
Copy constructor.
|
Response(String s) |
Response(String s,
boolean supportsUtf8)
Constructor for testing.
|
Modifier and Type | Method and Description |
---|---|
static Response |
byeResponse(Exception ex)
Return a Response object that looks like a BYE protocol response.
|
Exception |
getException()
Return the exception for a synthetic BYE 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 |
isNextNonSpace(char c)
Skip past any spaces.
|
boolean |
isNO() |
boolean |
isOK() |
boolean |
isSynthetic() |
boolean |
isTagged() |
boolean |
isUnTagged() |
byte |
peekByte() |
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.
|
String[] |
readAtomStringList() |
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()
Extract a NSTRING, 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[] |
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.
|
boolean |
supportsUtf8()
Does the server support UTF-8?
|
String |
toString() |
protected int index
protected int pindex
protected int size
protected byte[] buffer
protected int type
protected String tag
protected Exception ex
protected boolean utf8
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
public Response(String s)
public Response(String s, boolean supportsUtf8)
s
- the response stringsupportsUtf8
- allow UTF-8 in response?public Response(Protocol p) throws IOException, ProtocolException
p
- the Protocol objectIOException
- for I/O errorsProtocolException
- for protocol failurespublic Response(Response r)
r
- the Response to copypublic static Response byeResponse(Exception ex)
ex
- the exceptionpublic boolean supportsUtf8()
public void skipSpaces()
public boolean isNextNonSpace(char c)
c
- the character to look forpublic void skipToken()
public void skip(int count)
public byte peekByte()
public byte readByte()
public String readAtom()
public String readString(char delim)
delim
- the delimiter characterpublic String[] readStringList()
public String[] readAtomStringList()
public int readNumber()
public long readLong()
public String readString()
public ByteArrayInputStream readBytes()
public ByteArray readByteArray()
public String readAtomString()
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 String getTag()
public String getRest()
public Exception getException()
public void reset()
Copyright © 2019 JBoss by Red Hat. All rights reserved.