Struct SerializedObjectReader
The Serialized
Implements
Inherited Members
Namespace: Unity.Serialization.Json
Assembly: Unity.Serialization.dll
Syntax
public struct SerializedObjectReader : IDisposable
Constructors
SerializedObjectReader(char*, int, PackedBinaryStream, SerializedObjectReaderConfiguration, Allocator)
Initializes a new instance of the Serialized
Declaration
public SerializedObjectReader(char* buffer, int length, PackedBinaryStream output, SerializedObjectReaderConfiguration configuration, Allocator label = Allocator.TempJob)
Parameters
Type | Name | Description |
---|---|---|
char* | buffer | The pointer to the input buffer. |
int | length | The input buffer length. |
Packed |
output | The output stream. |
Serialized |
configuration | The configuration parameters to use for the reader. |
Allocator | label | The memory allocator label to use. |
SerializedObjectReader(char*, int, SerializedObjectReaderConfiguration, Allocator)
Initializes a new instance of the Serialized
Declaration
public SerializedObjectReader(char* buffer, int length, SerializedObjectReaderConfiguration configuration, Allocator label = Allocator.TempJob)
Parameters
Type | Name | Description |
---|---|---|
char* | buffer | The pointer to the input buffer. |
int | length | The input buffer length. |
Serialized |
configuration | The configuration parameters to use for the reader. |
Allocator | label | The memory allocator label to use. |
SerializedObjectReader(Stream, Allocator, bool)
Initializes a new instance of the Serialized
Declaration
public SerializedObjectReader(Stream input, Allocator label = Allocator.TempJob, bool leaveInputOpen = true)
Parameters
Type | Name | Description |
---|---|---|
Stream | input | The input stream. |
Allocator | label | The memory allocator label to use. |
bool | leaveInputOpen | True to leave the input stream open after the reader object is disposed; otherwise, false. |
SerializedObjectReader(Stream, PackedBinaryStream, Allocator, bool, bool)
Initializes a new instance of the Serialized
Declaration
public SerializedObjectReader(Stream input, PackedBinaryStream output, Allocator label = Allocator.TempJob, bool leaveInputOpen = true, bool leaveOutputOpen = true)
Parameters
Type | Name | Description |
---|---|---|
Stream | input | The input stream. |
Packed |
output | The output stream. |
Allocator | label | The memory allocator label to use. |
bool | leaveInputOpen | True to leave the input stream open after the reader object is disposed; otherwise, false. |
bool | leaveOutputOpen | True to leave the output stream open after the reader object is disposed; otherwise, false. |
SerializedObjectReader(Stream, PackedBinaryStream, SerializedObjectReaderConfiguration, Allocator, bool, bool)
Initializes a new instance of the Serialized
Declaration
public SerializedObjectReader(Stream input, PackedBinaryStream output, SerializedObjectReaderConfiguration configuration, Allocator label = Allocator.TempJob, bool leaveInputOpen = true, bool leaveOutputOpen = true)
Parameters
Type | Name | Description |
---|---|---|
Stream | input | The input stream. |
Packed |
output | The output stream. |
Serialized |
configuration | The configuration parameters to use for the reader. |
Allocator | label | The memory allocator label to use. |
bool | leaveInputOpen | True to leave the input stream open after the reader object is disposed; otherwise, false. |
bool | leaveOutputOpen | True to leave the output stream open after the reader object is disposed; otherwise, false. |
Exceptions
Type | Condition |
---|---|
Argument |
The configuration is invalid. |
SerializedObjectReader(Stream, SerializedObjectReaderConfiguration, Allocator, bool)
Initializes a new instance of the Serialized
Declaration
public SerializedObjectReader(Stream input, SerializedObjectReaderConfiguration configuration, Allocator label = Allocator.TempJob, bool leaveInputOpen = true)
Parameters
Type | Name | Description |
---|---|---|
Stream | input | The input stream. |
Serialized |
configuration | The configuration parameters to use for the reader. |
Allocator | label | The memory allocator label to use. |
bool | leaveInputOpen | True to leave the input stream open after the reader object is disposed; otherwise, false. |
SerializedObjectReader(string, Allocator)
Initializes a new instance of the Serialized
Declaration
public SerializedObjectReader(string path, Allocator label = Allocator.TempJob)
Parameters
Type | Name | Description |
---|---|---|
string | path | A relative or absolute file path. |
Allocator | label | The memory allocator label to use. |
SerializedObjectReader(string, PackedBinaryStream, Allocator, bool)
Initializes a new instance of the Serialized
Declaration
public SerializedObjectReader(string path, PackedBinaryStream output, Allocator label = Allocator.TempJob, bool leaveOutputOpen = true)
Parameters
Type | Name | Description |
---|---|---|
string | path | A relative or absolute file path. |
Packed |
output | The output stream. |
Allocator | label | The memory allocator label to use. |
bool | leaveOutputOpen | True to leave the stream open after the reader object is disposed; otherwise, false. |
SerializedObjectReader(string, PackedBinaryStream, SerializedObjectReaderConfiguration, Allocator, bool)
Initializes a new instance of the Serialized
Declaration
public SerializedObjectReader(string path, PackedBinaryStream output, SerializedObjectReaderConfiguration configuration, Allocator label = Allocator.TempJob, bool leaveOutputOpen = true)
Parameters
Type | Name | Description |
---|---|---|
string | path | A relative or absolute file path. |
Packed |
output | The output stream. |
Serialized |
configuration | The configuration parameters to use for the reader. |
Allocator | label | The memory allocator label to use. |
bool | leaveOutputOpen | True to leave the output stream open after the reader object is disposed; otherwise, false. |
SerializedObjectReader(string, SerializedObjectReaderConfiguration, Allocator)
Initializes a new instance of the Serialized
Declaration
public SerializedObjectReader(string path, SerializedObjectReaderConfiguration configuration, Allocator label = Allocator.TempJob)
Parameters
Type | Name | Description |
---|---|---|
string | path | A relative or absolute file path. |
Serialized |
configuration | The configuration parameters to use for the reader. |
Allocator | label | The memory allocator label to use. |
SerializedObjectReader(PackedBinaryStream, SerializedObjectReaderConfiguration, Allocator)
Initializes a new instance of the Serialized
Declaration
public SerializedObjectReader(PackedBinaryStream output, SerializedObjectReaderConfiguration configuration, Allocator label = Allocator.TempJob)
Parameters
Type | Name | Description |
---|---|---|
Packed |
output | The output stream. |
Serialized |
configuration | The configuration parameters to use for the reader. |
Allocator | label | The memory allocator label to use. |
SerializedObjectReader(SerializedObjectReaderConfiguration, Allocator)
Initializes a new instance of the Serialized
Declaration
public SerializedObjectReader(SerializedObjectReaderConfiguration configuration, Allocator label = Allocator.TempJob)
Parameters
Type | Name | Description |
---|---|---|
Serialized |
configuration | The configuration parameters to use for the reader. |
Allocator | label | The memory allocator label to use. |
Properties
RequiresExplicitExceptionHandling
If this flag is true. No exceptions are thrown unless Check
Declaration
public bool RequiresExplicitExceptionHandling { get; set; }
Property Value
Type | Description |
---|---|
bool |
Methods
CheckAndThrowInvalidJsonException()
Throws any invalid json exceptions generated from within a burst context.
Declaration
public void CheckAndThrowInvalidJsonException()
DiscardCompleted()
Discards completed data from the buffers.
Declaration
public void DiscardCompleted()
Dispose()
Releases all resources used by the Serialized
Declaration
public void Dispose()
Read(char*, int)
Reads the specified data and returns a new Serialized
Declaration
public SerializedValueView Read(char* ptr, int length)
Parameters
Returns
Type | Description |
---|---|
Serialized |
The view for the first node in the stream. |
Remarks
This will invalidate any generated views from this reader.
Read(NodeType)
Reads the next node in the stream, respecting depth/scope.
Declaration
public NodeType Read(NodeType node = (NodeType)-1)
Parameters
Type | Name | Description |
---|---|---|
Node |
node | The node type to stop at. |
Returns
Type | Description |
---|---|
Node |
The node type that was read. |
Read(out SerializedValueView, NodeType)
Reads the next node in the stream, respecting depth/scope.
Declaration
public NodeType Read(out SerializedValueView view, NodeType node = (NodeType)-1)
Parameters
Type | Name | Description |
---|---|---|
Serialized |
view | The view at the returned node type. |
Node |
node | The node type to stop at. |
Returns
Type | Description |
---|---|
Node |
The node type the parser stopped at. |
ReadArrayElement(out SerializedValueView)
Reads the next node as an array element.
Declaration
public bool ReadArrayElement(out SerializedValueView view)
Parameters
Type | Name | Description |
---|---|---|
Serialized |
view | The view of the array element. |
Returns
Type | Description |
---|---|
bool | True if the element was successfully read, false otherwise. |
ReadArrayElementBatch(NativeArray<SerializedValueView>, int)
Reads the next count elements of an array and writes views to the given buffer.
Declaration
public int ReadArrayElementBatch(NativeArray<SerializedValueView> views, int count)
Parameters
Type | Name | Description |
---|---|---|
Native |
views | The array to write the views to. |
int | count | The number of elements to read. |
Returns
Type | Description |
---|---|
int | The number of elements read. |
Exceptions
Type | Condition |
---|---|
Index |
The count exceeded the array of views. |
ReadArrayElementBatch(SerializedValueView*, int)
Reads the next count elements of an array and writes views to the given buffer.
Declaration
public int ReadArrayElementBatch(SerializedValueView* views, int count)
Parameters
Type | Name | Description |
---|---|---|
Serialized |
views | The buffer to write the views to. |
int | count | The number of elements to read. |
Returns
Type | Description |
---|---|
int | The number of elements read. |
ReadMember()
Reads the next node as a Serialized
Declaration
public SerializedMemberView ReadMember()
Returns
Type | Description |
---|---|
Serialized |
Exceptions
Type | Condition |
---|---|
Invalid |
The reader state is invalid. |
ReadMember(SerializedMemberViewCollection)
Reads the next node as a member, respecting depth/scope and adds it to the given Serialized
Declaration
public void ReadMember(SerializedMemberViewCollection collection)
Parameters
Type | Name | Description |
---|---|---|
Serialized |
collection | The collection to add the member to. |
ReadObject()
Reads the next node as a Serialized
Declaration
public SerializedObjectView ReadObject()
Returns
Type | Description |
---|---|
Serialized |
The Serialized |
Exceptions
Type | Condition |
---|---|
Invalid |
The reader state is invalid. |
Reset()
Resets the reader for re-use.
Declaration
public void Reset()
SetSource(char*, int)
Sets the data source for the reader.
Declaration
public void SetSource(char* ptr, int length)
Parameters
Remarks
This will invalidate any generated views from this reader.
Step(NodeType)
Advances the reader to the given node type, ignoring depth/scope.
Declaration
public NodeType Step(NodeType node = (NodeType)-1)
Parameters
Type | Name | Description |
---|---|---|
Node |
node | The node type to stop at. |
Returns
Type | Description |
---|---|
Node |
The node type the parser stopped at. |
Step(out SerializedValueView, NodeType)
Advances the reader to the given node type, ignoring depth/scope.
Declaration
public NodeType Step(out SerializedValueView view, NodeType node = (NodeType)-1)
Parameters
Type | Name | Description |
---|---|---|
Serialized |
view | The view at the returned node type. |
Node |
node | The node type to stop at. |
Returns
Type | Description |
---|---|
Node |
The node type the parser stopped at. |