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