WriteBytes() public method

public WriteBytes ( byte buffer, ushort count ) : void
buffer byte
count ushort
return void
Example #1
0
        public void Write(string value)
        {
            if (value == null)
            {
                m_Buffer.WriteByte2(0, 0);
                return;
            }
            int byteCount = s_Encoding.GetByteCount(value);

            if (byteCount >= 32768)
            {
                throw new IndexOutOfRangeException("Serialize(string) too long: " + value.Length);
            }
            Write((ushort)byteCount);
            int bytes = s_Encoding.GetBytes(value, 0, value.Length, s_StringWriteBuffer, 0);

            m_Buffer.WriteBytes(s_StringWriteBuffer, (ushort)bytes);
        }
Example #2
0
 internal bool HandleFragment(NetworkReader reader)
 {
     if (reader.ReadByte() == 0)
     {
         if (!readingFragment)
         {
             fragmentBuffer.SeekZero();
             readingFragment = true;
         }
         byte[] array = reader.ReadBytesAndSize();
         fragmentBuffer.WriteBytes(array, (ushort)array.Length);
         return(false);
     }
     readingFragment = false;
     return(true);
 }
Example #3
0
        internal bool HandleFragment(NetworkReader reader)
        {
            int state = reader.ReadByte();

            if (state == 0)
            {
                if (readingFragment == false)
                {
                    fragmentBuffer.SeekZero();
                    readingFragment = true;
                }

                byte[] data = reader.ReadBytesAndSize();
                fragmentBuffer.WriteBytes(data, (ushort)data.Length);
                return(false);
            }
            else
            {
                readingFragment = false;
                return(true);
            }
        }