Default implementation of the ISerializable interface that uses an IDataStream for reading and writing binary data.
sealed class
|
Serializer
|
extends
|
SerializerStream
|
An instance of ITypeSerializer for signed 32-bit integers.
public
static
readonly
field
|
Int32
|
||
type
|
ITypeSerializer<int32>
|
Creates a new instance of ISerializer.
public
static
method
|
For
(IDataStream stream,
bool loadLazy = true)
|
||
type
|
Serializer
|
||
params
|
stream
|
[not-null]
|
The data stream to use. |
loadLazy
|
Load
lazy
types
if
necessary?
Defaults
to
true . |
||
returns
|
|
The created ISerializer object. |
Clones the given serializable object.
public
static
method
|
Clone
(ISerializable obj)
|
||
type
|
ISerializable
|
||
params
|
obj
|
The object to clone. | |
returns
|
The cloned object. |
Remarks:
The clone is created by first serializing the given object and then deserializing the clone from the binary data stream.
Deserializes an object from the given data stream.
[OwnerReturn]
|
||||
public
static
method
|
Deserialize
([Owner]
IDataStream stream,
bool loadLazy = true)
|
|||
type
|
ISerializable
|
|||
params
|
stream
|
[not-null]
|
The data stream. | |
loadLazy
|
Load
lazy
types
if
necessary?
Defaults
to
true . |
|||
returns
|
The
deserialized
object
or
null . |
Deserializes an object from the given byte buffer.
[OwnerReturn]
|
||||
public
static
method
|
Deserialize
([Owner]
ByteBuffer buffer,
bool loadLazy = true)
|
|||
type
|
ISerializable
|
|||
params
|
buffer
|
The byte buffer. | ||
loadLazy
|
Load
lazy
types
if
necessary?
Defaults
to
true . |
|||
returns
|
The
deserialized
object
or
null
if
the
serialized
object
was
null
or
buffer
is
null .
|
Remarks:
LittleEndian will be used for reading multi-byte values.
Deserializes an object from the given file.
[OwnerReturn]
|
||||
public
static
method
|
Deserialize
(Path file,
bool loadLazy = true)
|
|||
type
|
ISerializable
|
|||
params
|
file
|
[not-null]
|
The file path. | |
loadLazy
|
Load
lazy
types
if
necessary?
Defaults
to
true . |
|||
returns
|
The
deserialized
object
or
null . |
Remarks:
LittleEndian will be used for reading multi-byte values.
Flushes all cached data.
public
override
method
|
Flush
()
|
||
inherited
|
SerializerStream.Flush
|
Remarks:
Performing a flush may result in I/O work. Depending on the semantics of the implementing class, this work may need to be wrapped in special Begin / End method calls. See the documentation of the implementing classes for details.
In case this object represents a read-only resource, calling the Flush method has no effect.
Reads a number of bytes from the stream.
public
override
method
|
Read
(ByteBuffer bytes)
|
||
type
|
int32
|
||
params
|
bytes
|
[not-null]
|
The buffer where the read bytes will be stored. |
returns
|
|
The number of bytes the have been read. | |
inherited
|
SerializerStream.Read
|
Remarks:
The number of bytes that are read from the stream may be less than the number of Remaining bytes in the given ByteBuffer, for any arbitrary reason.
Exceptions:
Reads a number of bytes from the stream.
public
override
method
|
ReadAll
(ByteBuffer bytes)
|
||
params
|
bytes
|
[not-null]
|
The buffer where the read bytes will be stored. |
inherited
|
SerializerStream.ReadAll
|
Remarks:
The number of bytes that are read from the stream will be equal to the number of Remaining bytes in the given ByteBuffer.
Exceptions:
Returns a data token of the object being deserialized.
public
method
|
ReadBool
()
|
||
type
|
bool
|
||
returns
|
The data token value. | ||
inherited
|
SerializerBase.ReadBool
|
Returns a data token of the object being deserialized.
public
method
|
ReadBoolArray
()
|
||
type
|
bool[]
|
||
returns
|
The data token value. | ||
inherited
|
SerializerBase.ReadBoolArray
|
Returns a data token of the object being deserialized.
[OwnerReturn]
|
||||
public
method
|
ReadByteBuffer
()
|
|||
type
|
ByteBuffer
|
|||
returns
|
The data token value. | |||
inherited
|
SerializerBase.ReadByteBuffer
|
Reads a 32-bit floating point value from the data stream.
public
override
method
|
ReadFloat32
()
|
||
type
|
float32
|
||
returns
|
The read value. | ||
inherited
|
SerializerStream.ReadFloat32
|
Exceptions:
Returns a data token of the object being deserialized.
public
method
|
ReadFloat32Array
()
|
||
type
|
float32[]
|
||
returns
|
The data token value. | ||
inherited
|
SerializerBase.ReadFloat32Array
|
Reads 32-bit floating point values from the data stream.
public
override
method
|
ReadFloat32s
(float32[] array,
int32 offset,
int32 count)
|
||
params
|
array
|
[not-null]
|
The output array. |
offset
|
[>=0]
|
Index of first array element to write. | |
count
|
[>=0]
|
Number of values to read. | |
returns
|
The read value. | ||
inherited
|
SerializerStream.ReadFloat32s
|
Exceptions:
Reads a 64-bit floating point value from the data stream.
public
override
method
|
ReadFloat64
()
|
||
type
|
float64
|
||
returns
|
The read value. | ||
inherited
|
SerializerStream.ReadFloat64
|
Exceptions:
Returns a data token of the object being deserialized.
public
method
|
ReadFloat64Array
()
|
||
type
|
float64[]
|
||
returns
|
The data token value. | ||
inherited
|
SerializerBase.ReadFloat64Array
|
Reads 64-bit floating point values from the data stream.
public
override
method
|
ReadFloat64s
(float64[] array,
int32 offset,
int32 count)
|
||
params
|
array
|
[not-null]
|
The output array. |
offset
|
[>=0]
|
Index of first array element to write. | |
count
|
[>=0]
|
Number of values to read. | |
returns
|
The read value. | ||
inherited
|
SerializerStream.ReadFloat64s
|
Exceptions:
Reads a signed 16-bit integer value from the data stream using.
public
override
method
|
ReadInt16
()
|
||
type
|
int16
|
||
returns
|
The read value. | ||
inherited
|
SerializerStream.ReadInt16
|
Exceptions:
Returns a data token of the object being deserialized.
public
method
|
ReadInt16Array
()
|
||
type
|
int16[]
|
||
returns
|
The data token value. | ||
inherited
|
SerializerBase.ReadInt16Array
|
Reads signed 16-bit integer value values from the data stream.
public
override
method
|
ReadInt16s
(int16[] array,
int32 offset,
int32 count)
|
||
params
|
array
|
[not-null]
|
The output array. |
offset
|
[>=0]
|
Index of first array element to write. | |
count
|
[>=0]
|
Number of values to read. | |
returns
|
The read value. | ||
inherited
|
SerializerStream.ReadInt16s
|
Exceptions:
Reads a signed 32-bit integer value from the data stream.
public
override
method
|
ReadInt32
()
|
||
type
|
int32
|
||
returns
|
The read value. | ||
inherited
|
SerializerStream.ReadInt32
|
Exceptions:
Returns a data token of the object being deserialized.
public
method
|
ReadInt32Array
()
|
||
type
|
int32[]
|
||
returns
|
The data token value. | ||
inherited
|
SerializerBase.ReadInt32Array
|
Reads signed 32-bit integer value values from the data stream.
public
override
method
|
ReadInt32s
(int32[] array,
int32 offset,
int32 count)
|
||
params
|
array
|
[not-null]
|
The output array. |
offset
|
[>=0]
|
Index of first array element to write. | |
count
|
[>=0]
|
Number of values to read. | |
returns
|
The read value. | ||
inherited
|
SerializerStream.ReadInt32s
|
Exceptions:
Reads a signed 64-bit integer value from the data stream.
public
override
method
|
ReadInt64
()
|
||
type
|
int64
|
||
returns
|
The read value. | ||
inherited
|
SerializerStream.ReadInt64
|
Exceptions:
Returns a data token of the object being deserialized.
public
method
|
ReadInt64Array
()
|
||
type
|
int64[]
|
||
returns
|
The data token value. | ||
inherited
|
SerializerBase.ReadInt64Array
|
Reads signed 64-bit integer value values from the data stream.
public
override
method
|
ReadInt64s
(int64[] array,
int32 offset,
int32 count)
|
||
params
|
array
|
[not-null]
|
The output array. |
offset
|
[>=0]
|
Index of first array element to write. | |
count
|
[>=0]
|
Number of values to read. | |
returns
|
The read value. | ||
inherited
|
SerializerStream.ReadInt64s
|
Exceptions:
Reads an 8-bit value from the stream.
public
override
method
|
ReadInt8
()
|
||
type
|
int8
|
||
returns
|
The read value. | ||
inherited
|
SerializerStream.ReadInt8
|
Exceptions:
Returns a data token of the object being deserialized.
public
method
|
ReadInt8Array
()
|
||
type
|
int8[]
|
||
returns
|
The data token value. | ||
inherited
|
SerializerBase.ReadInt8Array
|
Reads signed 8-bit integer value values from the data stream.
public
override
method
|
ReadInt8s
(int8[] array,
int32 offset,
int32 count)
|
||
params
|
array
|
[not-null]
|
The output array. |
offset
|
[>=0]
|
Index of first array element to write. | |
count
|
[>=0]
|
Number of values to read. | |
returns
|
The read value. | ||
inherited
|
SerializerStream.ReadInt8s
|
Exceptions:
Returns a data token of the object being deserialized.
[OwnerReturn]
|
||||
public
override
method
|
ReadObject
()
|
|||
type
|
ISerializable
|
|||
returns
|
The data token value. | |||
implements
|
SerializerBase.ReadObject
|
Returns a data token of the object being deserialized.
public
virtual
method
|
ReadString
()
|
||
type
|
string
|
||
returns
|
The data token value. | ||
inherited
|
SerializerBase.ReadString
|
Reads an unsigned 16-bit integer value from the data stream.
public
method
|
ReadUInt16
()
|
||
type
|
int32
|
||
returns
|
The read value. | ||
inherited
|
SerializerBase.ReadUInt16
|
Exceptions:
Reads an unsigned 32-bit integer value from the data stream.
public
method
|
ReadUInt32
()
|
||
type
|
int64
|
||
returns
|
The read value. | ||
inherited
|
SerializerBase.ReadUInt32
|
Exceptions:
Reads an unsigned 8-bit integer from the data stream.
public
method
|
ReadUInt8
()
|
||
type
|
int32
|
||
returns
|
The read value. | ||
inherited
|
SerializerBase.ReadUInt8
|
Exceptions:
Serializes the given object.
[OwnerReturn]
|
||||
public
static
method
|
Serialize
(ISerializable obj)
|
|||
type
|
ByteBuffer
|
|||
params
|
obj
|
The
object
to
serialize
or
null . |
||
returns
|
|
The byte buffer that holds the serialized object data. |
Remarks:
LittleEndian will be used for writing multi-byte values.
Serializes the given object.
[OwnerReturn]
|
||||
public
static
method
|
Serialize
(ISerializable obj,
IDataStream stream)
|
|||
params
|
obj
|
The
object
to
serialize
or
null . |
||
stream
|
[not-null]
|
The stream to serialize to. |
Serializes the given object to the given file.
public
static
method
|
Serialize
(ISerializable obj,
Path file)
|
||
params
|
obj
|
The
object
to
serialize
or
null . |
|
file
|
[not-null]
|
The file path. |
Remarks:
LittleEndian will be used for writing multi-byte values.
Reads an unsigned 8-bit value from the stream.
public
override
method
|
TryReadUInt8
()
|
||
type
|
int32
|
||
returns
|
|
The
unsigned
8-bit
value
or
-1
if
the
end
of
the
stream
has
been
reached.
|
|
inherited
|
SerializerStream.TryReadUInt8
|
Writes a number of bytes to the stream.
public
override
method
|
Write
(ByteBuffer bytes)
|
||
params
|
bytes
|
[not-null]
|
The bytes to write. |
inherited
|
SerializerStream.Write
|
Exceptions:
Writes the value of a data token of the object being serialized.
public
method
|
WriteBool
(bool value)
|
||
params
|
value
|
The data token value. | |
inherited
|
SerializerBase.WriteBool
|
Writes the value of a data token of the object being serialized.
public
method
|
WriteBoolArray
(bool[] value)
|
||
params
|
value
|
The data token value. | |
inherited
|
SerializerBase.WriteBoolArray
|
Writes the value of a data token of the object being serialized.
public
method
|
WriteBoolArray
([]
bool[] value,
int32 first,
int32 count)
|
||
params
|
value
|
The data token value. | |
first
|
[>=0]
|
Index of first array element to write. | |
count
|
[>=0]
|
Number array elements to write. | |
inherited
|
SerializerBase.WriteBoolArray
|
Writes the value of a data token of the object being serialized.
public
method
|
WriteByteBuffer
(ByteBuffer buffer)
|
||
params
|
buffer
|
The data token value. | |
inherited
|
SerializerBase.WriteByteBuffer
|
Writes a 32-bit floating point value to the data stream.
public
override
method
|
WriteFloat32
(float32 value)
|
||
params
|
value
|
The value to write. | |
inherited
|
SerializerStream.WriteFloat32
|
Exceptions:
Writes the value of a data token of the object being serialized.
public
method
|
WriteFloat32Array
(float32[] value)
|
||
params
|
value
|
The data token value. | |
inherited
|
SerializerBase.WriteFloat32Array
|
Writes the value of a data token of the object being serialized.
public
method
|
WriteFloat32Array
([]
float32[] value,
int32 first,
int32 count)
|
||
params
|
value
|
The data token value. | |
first
|
[>=0]
|
Index of first array element to write. | |
count
|
[>=0]
|
Number array elements to write. | |
inherited
|
SerializerBase.WriteFloat32Array
|
Writes 32-bit floating point values to the data stream.
public
override
method
|
WriteFloat32s
(float32[] array,
int32 offset,
int32 count)
|
||
params
|
array
|
[not-null]
|
The input array. |
offset
|
[>=0]
|
Index of first array element to read. | |
count
|
[>=0]
|
Number of values to write. | |
returns
|
The read value. | ||
inherited
|
SerializerStream.WriteFloat32s
|
Exceptions:
Writes a 64-bit floating point value to the data stream.
public
override
method
|
WriteFloat64
(float64 value)
|
||
params
|
value
|
The value to write. | |
inherited
|
SerializerStream.WriteFloat64
|
Exceptions:
Writes the value of a data token of the object being serialized.
public
method
|
WriteFloat64Array
(float64[] value)
|
||
params
|
value
|
The data token value. | |
inherited
|
SerializerBase.WriteFloat64Array
|
Writes the value of a data token of the object being serialized.
public
method
|
WriteFloat64Array
([]
float64[] value,
int32 first,
int32 count)
|
||
params
|
value
|
The data token value. | |
first
|
[>=0]
|
Index of first array element to write. | |
count
|
[>=0]
|
Number array elements to write. | |
inherited
|
SerializerBase.WriteFloat64Array
|
Writes 64-bit floating point values to the data stream.
public
override
method
|
WriteFloat64s
(float64[] array,
int32 offset,
int32 count)
|
||
params
|
array
|
[not-null]
|
The input array. |
offset
|
[>=0]
|
Index of first array element to read. | |
count
|
[>=0]
|
Number of values to write. | |
returns
|
The read value. | ||
inherited
|
SerializerStream.WriteFloat64s
|
Exceptions:
Writes a signed 16-bit integer value to the data stream.
public
override
method
|
WriteInt16
(int16 value)
|
||
params
|
value
|
The value to write. | |
inherited
|
SerializerStream.WriteInt16
|
Exceptions:
Writes the value of a data token of the object being serialized.
public
method
|
WriteInt16Array
(int16[] value)
|
||
params
|
value
|
The data token value. | |
inherited
|
SerializerBase.WriteInt16Array
|
Writes the value of a data token of the object being serialized.
public
method
|
WriteInt16Array
([]
int16[] value,
int32 first,
int32 count)
|
||
params
|
value
|
The data token value. | |
first
|
[>=0]
|
Index of first array element to write. | |
count
|
[>=0]
|
Number array elements to write. | |
inherited
|
SerializerBase.WriteInt16Array
|
Writes signed 16-bit integer values to the data stream.
public
override
method
|
WriteInt16s
(int16[] array,
int32 offset,
int32 count)
|
||
params
|
array
|
[not-null]
|
The input array. |
offset
|
[>=0]
|
Index of first array element to read. | |
count
|
[>=0]
|
Number of values to write. | |
returns
|
The read value. | ||
inherited
|
SerializerStream.WriteInt16s
|
Exceptions:
Writes a signed 32-bit integer value to the data stream.
public
override
method
|
WriteInt32
(int32 value)
|
||
params
|
value
|
The value to write. | |
inherited
|
SerializerStream.WriteInt32
|
Exceptions:
Writes the value of a data token of the object being serialized.
public
method
|
WriteInt32Array
(int32[] value)
|
||
params
|
value
|
The data token value. | |
inherited
|
SerializerBase.WriteInt32Array
|
Writes the value of a data token of the object being serialized.
public
method
|
WriteInt32Array
([]
int32[] value,
int32 first,
int32 count)
|
||
params
|
value
|
The data token value. | |
first
|
[>=0]
|
Index of first array element to write. | |
count
|
[>=0]
|
Number array elements to write. | |
inherited
|
SerializerBase.WriteInt32Array
|
Writes signed 32-bit integer values to the data stream.
public
override
method
|
WriteInt32s
(int32[] array,
int32 offset,
int32 count)
|
||
params
|
array
|
[not-null]
|
The input array. |
offset
|
[>=0]
|
Index of first array element to read. | |
count
|
[>=0]
|
Number of values to write. | |
returns
|
The read value. | ||
inherited
|
SerializerStream.WriteInt32s
|
Exceptions:
Writes a signed 64-bit integer value to the data stream.
public
override
method
|
WriteInt64
(int64 value)
|
||
params
|
value
|
The value to write. | |
inherited
|
SerializerStream.WriteInt64
|
Exceptions:
Writes the value of a data token of the object being serialized.
public
method
|
WriteInt64Array
(int64[] value)
|
||
params
|
value
|
The data token value. | |
inherited
|
SerializerBase.WriteInt64Array
|
Writes the value of a data token of the object being serialized.
public
method
|
WriteInt64Array
([]
int64[] value,
int32 first,
int32 count)
|
||
params
|
value
|
The data token value. | |
first
|
[>=0]
|
Index of first array element to write. | |
count
|
[>=0]
|
Number array elements to write. | |
inherited
|
SerializerBase.WriteInt64Array
|
Writes signed 64-bit integer values to the data stream.
public
override
method
|
WriteInt64s
(int64[] array,
int32 offset,
int32 count)
|
||
params
|
array
|
[not-null]
|
The input array. |
offset
|
[>=0]
|
Index of first array element to read. | |
count
|
[>=0]
|
Number of values to write. | |
returns
|
The read value. | ||
inherited
|
SerializerStream.WriteInt64s
|
Exceptions:
Writes an 8-bit integer value to the stream.
public
override
method
|
WriteInt8
(int8 value)
|
||
params
|
value
|
The value to write. | |
inherited
|
SerializerStream.WriteInt8
|
Exceptions:
Writes the value of a data token of the object being serialized.
public
method
|
WriteInt8Array
(int8[] value)
|
||
params
|
value
|
The data token value. | |
inherited
|
SerializerBase.WriteInt8Array
|
Writes the value of a data token of the object being serialized.
public
method
|
WriteInt8Array
([]
int8[] value,
int32 first,
int32 count)
|
||
params
|
value
|
The data token value. | |
first
|
[>=0]
|
Index of first array element to write. | |
count
|
[>=0]
|
Number array elements to write. | |
inherited
|
SerializerBase.WriteInt8Array
|
Writes signed 8-bit integer values to the data stream.
public
override
method
|
WriteInt8s
(int8[] array,
int32 offset,
int32 count)
|
||
params
|
array
|
[not-null]
|
The input array. |
offset
|
[>=0]
|
Index of first array element to read. | |
count
|
[>=0]
|
Number of values to write. | |
returns
|
The read value. | ||
inherited
|
SerializerStream.WriteInt8s
|
Exceptions:
Writes the value of a data token of the object being serialized.
public
override
method
|
WriteObject
(ISerializable value)
|
||
params
|
value
|
The data token value. | |
implements
|
SerializerBase.WriteObject
|
Writes the value of a data token of the object being serialized.
public
virtual
method
|
WriteString
(string value)
|
||
params
|
value
|
The data token value. | |
inherited
|
SerializerBase.WriteString
|