Photon Bolt Engine API 1.3

Static Public Member Functions | List of all members
Photon.Bolt.ProtocolTokenUtils Class Reference

Utility methods to manage IProtocolToken's content More...

Static Public Member Functions

static T GetToken< T > ()
 Creates a new Protocol Token instance from a PooledProtocolToken type that can be reused by the pooling system More...
 
static IProtocolToken ReadToken (this UdpPacket packet)
 Reads a IProtocolToken from the UdpPacket More...
 
static void SerializeToken (this UdpPacket packet, ref IProtocolToken token)
 Handle Read and Write of a IProtocolToken based on the UdpPacket type, if UdpKit.UdpPacket.Write is true, this method will write the Token, or read it otherwise. More...
 
static byte[] ToByteArray (this IProtocolToken token)
 Convert the IProtocolToken into a byte array More...
 
static IProtocolToken ToToken (this byte[] bytes)
 Convert a byte array into a IProtocolToken More...
 
static void WriteToken (this UdpPacket packet, IProtocolToken token)
 Writes a IProtocolToken into this UdpPacket More...
 

Detailed Description

Utility methods to manage IProtocolToken's content

Member Function Documentation

◆ GetToken< T >()

static T Photon.Bolt.ProtocolTokenUtils.GetToken< T > ( )
inlinestatic

Creates a new Protocol Token instance from a PooledProtocolToken type that can be reused by the pooling system

Template Parameters
TProtocol Type that represents a PooledProtocolToken type
Returns
A new instance of a PooledProtocolToken
Type Constraints
T :PooledProtocolTokenBase 

◆ ReadToken()

static IProtocolToken Photon.Bolt.ProtocolTokenUtils.ReadToken ( this UdpPacket  packet)
inlinestatic

Reads a IProtocolToken from the UdpPacket

Parameters
packetPacket from where the Token will be read
Returns
IProtocolToken read from the tip of the Packet

◆ SerializeToken()

static void Photon.Bolt.ProtocolTokenUtils.SerializeToken ( this UdpPacket  packet,
ref IProtocolToken  token 
)
inlinestatic

Handle Read and Write of a IProtocolToken based on the UdpPacket type, if UdpKit.UdpPacket.Write is true, this method will write the Token, or read it otherwise.

Parameters
packetUdpPacket where the Token will be manupulated
tokenIProtocolToken to be written or read

◆ ToByteArray()

static byte [] Photon.Bolt.ProtocolTokenUtils.ToByteArray ( this IProtocolToken  token)
inlinestatic

Convert the IProtocolToken into a byte array

Parameters
tokenToken to be converted
Returns
Byte array with the Token content

◆ ToToken()

static IProtocolToken Photon.Bolt.ProtocolTokenUtils.ToToken ( this byte[]  bytes)
inlinestatic

Convert a byte array into a IProtocolToken

Parameters
bytesByte array to be converted
Returns
IProtocolToken of type described on the byte array

◆ WriteToken()

static void Photon.Bolt.ProtocolTokenUtils.WriteToken ( this UdpPacket  packet,
IProtocolToken  token 
)
inlinestatic

Writes a IProtocolToken into this UdpPacket

Parameters
packetPacket where the Token will be written
tokenIProtocolToken to be written at the end of the Packet