AMPS C# Client  5.3.5.0
AMPS C# Client for .NET
AMPS.Client.Fields.StringField Class Reference

Field data for a Message which consists of a string. More...

+ Inheritance diagram for AMPS.Client.Fields.StringField:

Public Member Functions

 StringField (string value)
 Initializes a new instance of the StringField class with the specified string value. More...
 
 StringField ()
 Default constructor. More...
 
virtual string getValue (Encoding decoder)
 Returns a string representation of the Field value, where the bytes are interpreted by using the specified decoder. More...
 
bool getValue (byte[] v)
 Writes the byte value of this instance into the specified byte buffer, if the value is not null. More...
 
bool getValue (CommandId v)
 Writes the byte value of this instance into the specified command ID object, if the value is not null. More...
 
void setValue (byte[] v, int offset, int length)
 Sets the value of this instance with the specified region of a byte buffer. More...
 
void setValue (CommandId v)
 Sets the value of this instance from the specified command ID. More...
 
void setValue (string v, Encoding encoder)
 Sets the value of this instance from the specified string. The characters of the string are interpreted using the specified encoder. This method makes its own copy of the bytes. More...
 
- Public Member Functions inherited from AMPS.Client.Fields.Field
 Field ()
 Default construntotor. More...
 
 Field (string value)
 Constructs an instance with the bytes of the specified string value. The string is interpreted as the UTF-8 representation. More...
 
 Field (byte[] buffer, int position, int length)
 Constructs an instance with the specified region of a byte buffer. Note: the bytes are not copied from the buffer. The specified buffer region is referenced by this instance. More...
 
void set (byte[] buffer, int position, int length)
 Sets the value of this instance with the specified region of a byte buffer. Note: the bytes are not copied from the buffer. The specified buffer region is referenced by this instance. More...
 
void set (byte[] buffer)
 Sets the value of this instance with the specified buffer. Note: the bytes are not copied from the buffer. The buffer is referenced by this instance. More...
 
bool isNull ()
 Indicates whether this instance's value is null. More...
 
void reset ()
 Resets the value of this instance to null. More...
 
byte byteAt (int i)
 Returns the byte at position plus index i. More...
 
override bool Equals (Object obj)
 Default implementation for Object#equals for a Field. For two Fields to be considered equal, their values must have the same length and all bytes in the value must be equal. More...
 
override int GetHashCode ()
 Gets the hash code for the Field. More...
 
Field copy ()
 Constructs a new Field and sets its value to a deep copy of this instance. More...
 
virtual void copyFrom (Field f)
 Provides a way to make this object a duplicate of f. More...
 

Protected Member Functions

 StringField (byte[] buffer, int position, int length)
 Initializes a new instance of the StringField class with the specified buffer, position, and length. More...
 

Static Protected Attributes

const string LATIN1 = "ISO-8859-1"
 
const byte LATIN1_ZERO = 48
 

Additional Inherited Members

- Public Attributes inherited from AMPS.Client.Fields.Field
byte[] buffer = null
 
int position = 0
 
int length = 0
 

Detailed Description

Field data for a Message which consists of a string.

Constructor & Destructor Documentation

◆ StringField() [1/3]

AMPS.Client.Fields.StringField.StringField ( byte[]  buffer,
int  position,
int  length 
)
inlineprotected

Initializes a new instance of the StringField class with the specified buffer, position, and length.

Parameters
bufferThe byte array buffer containing the string data.
positionThe starting position of the string within the buffer.
lengthThe length of the string.

◆ StringField() [2/3]

AMPS.Client.Fields.StringField.StringField ( string  value)
inline

Initializes a new instance of the StringField class with the specified string value.

Parameters
valueThe string value to initialize the StringField with.

◆ StringField() [3/3]

AMPS.Client.Fields.StringField.StringField ( )
inline

Default constructor.

Member Function Documentation

◆ getValue() [1/3]

bool AMPS.Client.Fields.StringField.getValue ( byte[]  v)
inline

Writes the byte value of this instance into the specified byte buffer, if the value is not null.

Parameters
vThe byte buffer to write in to.
Returns
Return true if this instance is not null, otherwise false.

◆ getValue() [2/3]

bool AMPS.Client.Fields.StringField.getValue ( CommandId  v)
inline

Writes the byte value of this instance into the specified command ID object, if the value is not null.

Parameters
vThe command ID object to write in to
Returns
Return true if this instance is not null, otherwise false.

◆ getValue() [3/3]

virtual string AMPS.Client.Fields.StringField.getValue ( Encoding  decoder)
inlinevirtual

Returns a string representation of the Field value, where the bytes are interpreted by using the specified decoder.

Parameters
decoderThe charset decoder used to interpret bytes as characters.
Returns
A newly-constructed String representing the value of this field.

Reimplemented in AMPS.Client.Fields.OptionsField.

◆ setValue() [1/3]

void AMPS.Client.Fields.StringField.setValue ( byte[]  v,
int  offset,
int  length 
)
inline

Sets the value of this instance with the specified region of a byte buffer.

Note: the bytes are not copied from the buffer. The specified buffer region is referenced by this instance.

Parameters
vThe byte buffer.
offsetThe starting position of the value in the byte buffer.
lengthThe length from the starting position of the value in the byte buffer.

◆ setValue() [2/3]

void AMPS.Client.Fields.StringField.setValue ( CommandId  v)
inline

Sets the value of this instance from the specified command ID.

Note: the bytes are not copied from the buffer. The specified buffer region is referenced by this instance. This is not a deep copy.

Parameters
vThe command ID object whose value is used to set this instance.

◆ setValue() [3/3]

void AMPS.Client.Fields.StringField.setValue ( string  v,
Encoding  encoder 
)
inline

Sets the value of this instance from the specified string. The characters of the string are interpreted using the specified encoder. This method makes its own copy of the bytes.

Parameters
vThe string used as the value.
encoderThe encoder used to interpret the string's characters as bytes.

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