Class IncomingMessage
Utility class for reading the data sent to the SideChannel.
Namespace: Unity.MLAgents.SideChannels
Syntax
public class IncomingMessage : IDisposable
Constructors
IncomingMessage(Byte[])
Construct an IncomingMessage from the byte array.
Declaration
public IncomingMessage(byte[] data)
Parameters
Type | Name | Description |
---|---|---|
Byte[] | data |
Methods
Dispose()
Clean up the internal storage.
Declaration
public void Dispose()
GetRawBytes()
Gets the original data of the message. Note that this will return all of the data, even if part of it has already been read.
Declaration
public byte[] GetRawBytes()
Returns
Type | Description |
---|---|
Byte[] |
ReadBoolean(Boolean)
Read a boolean value from the message.
Declaration
public bool ReadBoolean(bool defaultValue = false)
Parameters
Type | Name | Description |
---|---|---|
Boolean | defaultValue | Default value to use if the end of the message is reached. |
Returns
Type | Description |
---|---|
Boolean |
ReadFloat32(Single)
Read a float value from the message.
Declaration
public float ReadFloat32(float defaultValue = 0F)
Parameters
Type | Name | Description |
---|---|---|
Single | defaultValue | Default value to use if the end of the message is reached. |
Returns
Type | Description |
---|---|
Single |
ReadFloatList(IList<Single>)
Reads a list of floats from the message. The length of the list is stored in the message.
Declaration
public IList<float> ReadFloatList(IList<float> defaultValue = null)
Parameters
Type | Name | Description |
---|---|---|
IList<Single> | defaultValue | Default value to use if the end of the message is reached. |
Returns
Type | Description |
---|---|
IList<Single> |
ReadInt32(Int32)
Read an integer value from the message.
Declaration
public int ReadInt32(int defaultValue = 0)
Parameters
Type | Name | Description |
---|---|---|
Int32 | defaultValue | Default value to use if the end of the message is reached. |
Returns
Type | Description |
---|---|
Int32 |
ReadString(String)
Read a string value from the message.
Declaration
public string ReadString(string defaultValue = null)
Parameters
Type | Name | Description |
---|---|---|
String | defaultValue | Default value to use if the end of the message is reached. |
Returns
Type | Description |
---|---|
String |