NetMQ.Zyre.ZreMsg.GetLongString C# (CSharp) Méthode

GetLongString() private méthode

private GetLongString ( ) : string
Résultat string
        private string GetLongString()
        {
            int length = (int) GetNumber4();
            if (_offset + length > _buffer.Length)
            {
                throw new MessageException("Malformed message.");
            }

            string s = Encoding.UTF8.GetString(_buffer, _offset, length);

            _offset += length;

            return s;
        }

Usage Example

            internal void Read(ZreMsg m)
            {
                int listSize;
                int hashSize;
                int chunkSize;

                byte[] guidBytes;
                byte   version;

                // Version
                version = m.GetNumber1();
                if (version != 2)
                {
                    throw new MessageException("Version is invalid");
                }

                // Sequence
                Sequence = m.GetNumber2();

                // Endpoint
                Endpoint = m.GetString();

                // Groups
                listSize = (int)m.GetNumber4();
                Groups   = new List <string>(listSize);
                while (listSize-- > 0)
                {
                    string s = m.GetLongString();
                    Groups.Add(s);
                }

                // Status
                Status = m.GetNumber1();

                // Name
                Name = m.GetString();

                // Headers
                hashSize = (int)m.GetNumber4();
                Headers  = new Dictionary <string, string>();
                while (hashSize-- > 0)
                {
                    string key   = m.GetString();
                    string value = m.GetLongString();
                    Headers.Add(key, value);
                }
            }
All Usage Examples Of NetMQ.Zyre.ZreMsg::GetLongString