Phants Client for Redis™*
Public Member Functions | List of all members
MessageParser Class Reference
Inheritance diagram for MessageParser:
Inheritance graph
Collaboration diagram for MessageParser:
Collaboration graph

Public Member Functions

 MessageParser (ResponseProcessor responseProcessor)
void SimpleString (string s)
void Error (string error)
void Integer (long i)
void BulkStringBegin (int size)
void BulkStringData (byte[] data, int offset, int numBytes)
void BulkStringDone ()
void ArrayBegin (int size)
void ArrayDone ()

Detailed Description

This class serves as a concrete implementation of the RespParser interface. It handles parsing of redis subscription methods. Since messages use a fixed format, state is tracked and everything is parsed into a specific structure.

Constructor & Destructor Documentation

MessageParser ( ResponseProcessor  responseProcessor)

MessageParser constructor.

responseProcessorAfter messages are received and parsed, they are passed on to this ResponseProcessor.

Member Function Documentation

void ArrayBegin ( int  size)

Called at the start of a RESP Array.

sizeThe number of elements in the array being parsed.

Implements ArrayParser.

void ArrayDone ( )

Called at the end of a RESP Array.

Implements ArrayParser.

void BulkStringBegin ( int  size)

Called at the start of a RESP Bulk String.

sizeThe length of the string being parsed.

Implements BulkStringParser.

void BulkStringData ( byte[]  data,
int  offset,
int  numBytes 

Called when a block of string data has been read.

Since RESP Bulk Strings can be up to 512MB in length, this interface was designed to handle data in chunks (typically sent over a network). This method will be called as many times is as necessary to transfer the whole Bulk String.

dataA buffer containing the block of new bytes.
offsetThe zero-based offset into data where the new bytes are stored.
numBytesThe number of bytes read.

Implements BulkStringParser.

void BulkStringDone ( )

Called after the last byte(s) of a Bulk String have been parsed.

Implements BulkStringParser.

void Error ( string  error)

Called when an Error has been parsed.

errorThe error string that was parsed.

Implements ErrorParser.

void Integer ( long  i)

Called when an Integer has been parsed.

iThe value of the parsed Integer.

Implements IntegerParser.

void SimpleString ( string  s)

Called when a Simple String has been parsed.

sThe string that was parsed.

Implements SimpleStringParser.

The documentation for this class was generated from the following file: