Opc.Ua.JsonDecoder.ReadByteString C# (CSharp) Method

ReadByteString() public method

Reads a byte string from the stream.
public ReadByteString ( string fieldName ) : byte[]
fieldName string
return byte[]
        public byte[] ReadByteString(string fieldName)
        {
            object token = null;

            if (!ReadField(fieldName, out token))
            {
                return null;
            }

            var value = token as string;

            if (value == null)
            {
                return null;
            }

            var bytes = Convert.FromBase64String(value);

            if (m_context.MaxByteStringLength > 0 && m_context.MaxByteStringLength < bytes.Length)
            {
                throw new ServiceResultException(StatusCodes.BadEncodingLimitsExceeded);
            }

            return bytes;
        }