Phants Client for Redis™*
Public Member Functions | Public Attributes | List of all members
BufferDescriptor Class Reference

Public Member Functions

 BufferDescriptor (int bufferLen)
 
 BufferDescriptor (byte[] userBuffer)
 
int NumUnreadBytes ()
 
void ResetIndices ()
 

Public Attributes

byte[] data
 
int readIndex
 
int writeIndex
 

Detailed Description

Basically just a dumb struct for storing buffer state, but defined as a class so we can pass around references to it.

This is an internal class used to track network buffers, it currently serves no purpose in user code, but is public nonetheless.

Constructor & Destructor Documentation

BufferDescriptor ( int  bufferLen)
inline

Constructs a BufferDescriptor.

The buffer will be allocated internally with the given size.

Parameters
bufferLenSize of the buffer to allocate.
BufferDescriptor ( byte[]  userBuffer)
inline

Constructs a BufferDescriptor.

The user provided buffer will serve as the internal buffer.

Parameters
userBufferA user provided buffer.

Member Function Documentation

int NumUnreadBytes ( )
inline

Returns the number of unread bytes sitting in the buffer.

void ResetIndices ( )
inline

Discards the current buffer state by resetting the read/write indices.

Member Data Documentation

byte [] data

The backing buffer.

int readIndex

Zero-based index into data pointing to unread data.

int writeIndex

Zero-based index into data pointing to unwritten space.


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