Diffusion .NET Client Library
6.1.5
|
The data type that is specified for a particular value type. It provides methods to convert values to and from binary. Diffusion provides several IDataTypes implementations. More...
Public Member Functions | |
void | WriteValue (TValue value, Stream outputStream) |
Serializes a value to binary. More... | |
new TValue | ReadValue (byte[] input, int offset, int length) |
Parses a value from a binary data segment. More... | |
new TValue | ReadValue (byte[] input) |
Parses a value from a binary. More... | |
new TValue | ReadValue (IBytes bytes) |
Parses a value from binary. More... | |
void | Validate (TValue value) |
Checks whether a value is valid. More... | |
IDeltaType< TValue, TDelta > | DeltaType< TDelta > () |
Returns a IDeltaType by type. More... | |
IBytes | ToBytes (TValue value) |
Returns the serialized form of the given value as IBytes. More... | |
bool | CanReadAs< TResult > () |
Checks whether this data type is compatible with the given type parameter. More... | |
TResult | ReadAs< TResult > (byte[] input, int offset, int length) |
Creates a value of a compatible type from a binary data segment. More... | |
TResult | ReadAs< TResult > (byte[] input) |
Creates a value of a compatible type from a binary data segment. More... | |
TResult | ReadAs< TResult > (IBytes bytes) |
Creates a value of a compatible type from a binary. More... | |
Public Member Functions inherited from PushTechnology.ClientInterface.Data.IDataType | |
void | WriteValue (object value, Stream outputStream) |
Serializes a value to binary. More... | |
void | Validate (object value) |
Checks whether a value is valid. More... | |
IDeltaType | DeltaType (string typeName) |
Returns a IDeltaType by name. More... | |
IDeltaType | DeltaType (Type valueDeltaType) |
Returns a IDeltaType by type. More... | |
IBytes | ToBytes (object value) |
Returns the serialized form of the given value as IBytes. More... | |
bool | CanReadAs (Type resultType) |
Checks whether this data type is compatible with the given resultType . More... | |
object | ReadAs (Type resultType, byte[] input, int offset, int length) |
Creates a value of a compatible type from a binary data segment. More... | |
object | ReadAs (Type resultType, byte[] input) |
Creates a value of a compatible type from a binary data segment. More... | |
object | ReadAs (Type resultType, IBytes bytes) |
Creates a value of a compatible type from binary. More... | |
Additional Inherited Members | |
Properties inherited from PushTechnology.ClientInterface.Data.IDataType | |
string | TypeName [get] |
Returns the external type identifier. More... | |
The data type that is specified for a particular value type. It provides methods to convert values to and from binary. Diffusion provides several IDataTypes implementations.
This is a generic version of the IDataType interface that provides overloads for all object methods. It instead provides typed arguments and return values based on the given value type.
For more information about the data type interface, see
.
Since 5.8
TValue | The value type. |
bool PushTechnology.ClientInterface.Data.IDataType< TValue >.CanReadAs< TResult > | ( | ) |
Checks whether this data type is compatible with the given type parameter.
This means that any valid binary representation of this data type can be read as a instance of the given type parameter.
Since 6.0
TResult | The type to check for compatibility. |
IDeltaType<TValue, TDelta> PushTechnology.ClientInterface.Data.IDataType< TValue >.DeltaType< TDelta > | ( | ) |
Returns a IDeltaType by type.
TDelta | The delta value type. |
ArgumentException | This data type does not provide a IDeltaType for the given type or it provides more than one IDeltaType but none is preferred. |
TResult PushTechnology.ClientInterface.Data.IDataType< TValue >.ReadAs< TResult > | ( | byte[] | input, |
int | offset, | ||
int | length | ||
) |
Creates a value of a compatible type from a binary data segment.
Since 6.0.
TResult | The type of the result. |
input | The binary data. The implementation may re-use the array to avoid copying. The caller must ensure the array is not modified. |
offset | The starting index of the data segment. |
length | The length of the data segment. |
ArgumentException | Failed to read input as the given TResult type. |
InvalidOperationException | The given type is incompatible with this data type. |
TResult PushTechnology.ClientInterface.Data.IDataType< TValue >.ReadAs< TResult > | ( | byte[] | input | ) |
Creates a value of a compatible type from a binary data segment.
This is equivalent to calling
.
Since 6.0.
TResult | The type of the result. |
input | The binary data. The implementation may re-use the array to avoid copying. The caller must ensure the array is not modified. |
ArgumentException | Failed to read input as the given TResult type. |
InvalidOperationException | The given type is incompatible with this data type. |
TResult PushTechnology.ClientInterface.Data.IDataType< TValue >.ReadAs< TResult > | ( | IBytes | bytes | ) |
Creates a value of a compatible type from a binary.
This is equivalent to calling
.
Since 6.0.
TResult | The type of the result. |
bytes | The binary data. |
ArgumentException | Failed to read bytes as the given TResult type. |
InvalidOperationException | The given type is incompatible with this data type. |
new TValue PushTechnology.ClientInterface.Data.IDataType< TValue >.ReadValue | ( | byte[] | input, |
int | offset, | ||
int | length | ||
) |
Parses a value from a binary data segment.
input | The binary data. The implementation may re-use the array to avoid copying. The caller must ensure the array is not modified. |
offset | The starting index of the data segment. |
length | The length of the data segment. |
Implements PushTechnology.ClientInterface.Data.IDataType.
new TValue PushTechnology.ClientInterface.Data.IDataType< TValue >.ReadValue | ( | byte[] | input | ) |
Parses a value from a binary.
This is equivalent to ReadValue(input,0,input.Length).
input | The binary data. The implementation may re-use the array to avoid copying. The caller must ensure the array is not modified. |
Implements PushTechnology.ClientInterface.Data.IDataType.
new TValue PushTechnology.ClientInterface.Data.IDataType< TValue >.ReadValue | ( | IBytes | bytes | ) |
Parses a value from binary.
This is equivalent to ReadValue(bytes.ToByteArray()).
bytes | The binary data. |
Implements PushTechnology.ClientInterface.Data.IDataType.
IBytes PushTechnology.ClientInterface.Data.IDataType< TValue >.ToBytes | ( | TValue | value | ) |
void PushTechnology.ClientInterface.Data.IDataType< TValue >.Validate | ( | TValue | value | ) |
Checks whether a value is valid.
A DataType implementation is not required to check the binary data supplied to ReadValue(byte[],int,int). This method can be used the check the value at a later time.
value | The value to check for validity. |
InvalidDataException | The given value is invalid. |
void PushTechnology.ClientInterface.Data.IDataType< TValue >.WriteValue | ( | TValue | value, |
Stream | outputStream | ||
) |
Serializes a value to binary.
value | The value. |
outputStream | The output stream. |
ArgumentException | The given value is invalid for this data type. |