Scalien.BinaryListerThreadState.ParseKeyValue C# (CSharp) Method

ParseKeyValue() public static method

public static ParseKeyValue ( byte data, int pos, byte[]>.KeyValuePair &keyValue ) : int
data byte
pos int
keyValue byte[]>.KeyValuePair
return int
        public static int ParseKeyValue(byte[] data, int pos, ref KeyValuePair<byte[], byte[]> keyValue)
        {
            byte[] key = null;
            pos = ParseByteArray(data, pos, ref key);
            if (pos == -1)
                return -1;
            if (pos >= data.Length)
                return -1;
            if (data[pos] != ':')
                return -1;
            pos += 1;

            if (data[pos] != ' ')
                return -1;
            pos += 1;

            byte[] value = null;
            pos = ParseByteArray(data, pos, ref value);
            if (pos == -1)
                return -1;
            if (pos >= data.Length)
                return -1;
            if (data[pos] != '\n')
                return -1;
            pos += 1;

            keyValue = new KeyValuePair<byte[], byte[]>(key, value);
            return pos;
        }