Struct SubStream
Implements
Inherited Members
System.ValueType.Equals(System.Object)
System.ValueType.GetHashCode()
System.ValueType.ToString()
System.Object.Equals(System.Object, System.Object)
System.Object.GetType()
System.Object.ReferenceEquals(System.Object, System.Object)
Namespace: FishNet.Serializing
Assembly: FishNet.Runtime.dll
Syntax
public struct SubStream : IResettable
Fields
UNINITIALIZED_LENGTH
Length to use when SubStream is not initialized.
Declaration
public const int UNINITIALIZED_LENGTH = -1
Field Value
Type | Description |
---|---|
System.Int32 |
Properties
Initialized
Is Substream initialized (can be read from or written to)
Declaration
public bool Initialized { readonly get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Length
Returns Length of substream data
Declaration
public readonly int Length { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
NetworkManager
Returns NetworkManager that Substream was initialized with
Declaration
public readonly NetworkManager NetworkManager { get; }
Property Value
Type | Description |
---|---|
NetworkManager |
Remaining
Returns remaining bytes to read from substream
Declaration
public readonly int Remaining { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Methods
CreateFromReader(Reader, Int32)
Declaration
public static SubStream CreateFromReader(Reader originalReader, int subStreamLength)
Parameters
Type | Name | Description |
---|---|---|
Reader | originalReader | |
System.Int32 | subStreamLength |
Returns
Type | Description |
---|---|
SubStream |
InitializeState()
Declaration
public void InitializeState()
ResetReaderToStartPosition()
Resets reader to start position, so you can read data again from start of substream.
Declaration
public void ResetReaderToStartPosition()
Exceptions
Type | Condition |
---|---|
System.ArgumentException |
ResetState()
Do not forget to call this after:
- you stopped writing to Substream AND already sent it via RPCs/Broadcasts
- you stoped reading from it inside RPCs/Broadcast receive event
- if you use it in Reconcile method, you have dispose SubStream inside Dispose() of IReconcileData struct
Declaration
public void ResetState()
StartReading(out Reader)
Starts reading from substream via Reader class. Do not forget do Dispose() after reading
Declaration
public bool StartReading(out Reader reader)
Parameters
Type | Name | Description |
---|---|---|
Reader | reader | Reader to read data from |
Returns
Type | Description |
---|---|
System.Boolean | Returns true, if SubStream is initialized else false |
StartWriting(NetworkManager, out PooledWriter, Int32)
Creates SubStream for writing, use this before sending into RPC or Broadcast
Declaration
public static SubStream StartWriting(NetworkManager manager, out PooledWriter writer, int minimumLength = 0)
Parameters
Type | Name | Description |
---|---|---|
NetworkManager | manager | Need to include network manager for handling of networked IDs |
PooledWriter | writer | |
System.Int32 | minimumLength | Minimum expected length of data, that will be written |
Returns
Type | Description |
---|---|
SubStream | Returns writer of SubStream |