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

Public Member Functions

 BulkStringArraySinkAdapter (BulkStringArrayCallback arrayCallback, ErrorCallback errorCallback)
 
void ArrayBegin (int size)
 
void ArrayDone ()
 
void BulkStringBegin (int size)
 
void BulkStringData (byte[] data, int offset, int numBytes)
 
void BulkStringDone ()
 
void Integer (long i)
 
void SimpleString (string s)
 
void Error (string error)
 

Detailed Description

An implementation of the ArraySink interface that is designed to handle RESP Arrays of Bulk Strings.

This adapter only handles RESP arrays of Bulk Strings, which is a common response format for many Redis commands (e.g. HKEYS, SORT).
This particular Sink Adapter is not a terribly efficient implementation, but serves as a working example of how it can be done.

Constructor & Destructor Documentation

BulkStringArraySinkAdapter ( BulkStringArrayCallback  arrayCallback,
ErrorCallback  errorCallback 
)
inline

Constructs a BulkStringArraySinkAdapter.

Parameters
arrayCallbackDelegate method that is called when a RESP Array of Bulk Strings has been received.
errorCallbackDelegate method that is called when a RESP Error has been received.

Member Function Documentation

void ArrayBegin ( int  size)
inline

Called at the start of a RESP Array.

Parameters
sizeThe number of elements in the array being parsed.

Implements ArrayParser.

void ArrayDone ( )
inline

Called at the end of a RESP Array.

Implements ArrayParser.

void BulkStringBegin ( int  size)
inline

Called at the start of a RESP Bulk String.

Parameters
sizeThe length of the string being parsed.

Implements BulkStringParser.

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

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.

Parameters
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 ( )
inline

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

Implements BulkStringParser.

void Error ( string  error)
inline

Called when an Error has been parsed.

Parameters
errorThe error string that was parsed.

Implements ErrorParser.

void Integer ( long  i)
inline

Called when an Integer has been parsed.

Parameters
iThe value of the parsed Integer.

Implements IntegerParser.

void SimpleString ( string  s)
inline

Called when a Simple String has been parsed.

Parameters
sThe string that was parsed.

Implements SimpleStringParser.


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