This repository has been archived on 2023-09-13. You can view files and clone it, but cannot push or open issues or pull requests.
station_obscurum_unity/Assets/Packages/FishNet/Runtime/Serializing/ReaderStatics.cs

47 lines
1.1 KiB
C#
Raw Permalink Normal View History

2023-05-31 17:32:21 +02:00
using FishNet.Documenting;
using System;
using System.Text;
namespace FishNet.Serializing
{
/// <summary>
/// Writes data to a buffer.
/// </summary>
[APIExclude]
internal class ReaderStatics
{
/* Since serializing occurs on the main thread this value may
* be shared among all readers. //multithread
*/
#region Private.
/// <summary>
/// Buffer to copy Guids into.
/// </summary>
private static byte[] _guidBuffer = new byte[16];
/// <summary>
/// Used to encode strings.
/// </summary>
private static readonly UTF8Encoding _encoding = new UTF8Encoding(false, true);
#endregion
/// <summary>
/// Gets the GUID Buffer.
/// </summary>
/// <returns></returns>
public static byte[] GetGuidBuffer()
{
return _guidBuffer;
}
/// <summary>
/// Returns a string from data.
/// </summary>
public static string GetString(ArraySegment<byte> data)
{
return _encoding.GetString(data.Array, data.Offset, data.Count);
}
}
}