Пример #1
0
 /// <summary> Adds a string value to the attribute.
 ///
 /// </summary>
 /// <param name="attrString">Value of the attribute as a String.
 ///
 /// @throws IllegalArgumentException if attrString is null
 /// </param>
 public virtual void addValue(string attrString)
 {
     if (attrString == null)
     {
         throw new ArgumentException("Attribute value cannot be null");
     }
     try
     {
         Encoding encoder = Encoding.GetEncoding("utf-8");
         byte[]   ibytes  = encoder.GetBytes(attrString);
         sbyte[]  sbytes  = SupportClass.ToSByteArray(ibytes);
         this.add(sbytes);
         //				this.add(attrString.getBytes("UTF-8"));
     }
     catch (IOException ue)
     {
         throw new SystemException(ue.ToString());
     }
 }
Пример #2
0
        /// <summary> Constructs an attribute with a single string value.
        ///
        /// </summary>
        /// <param name="attrName">Name of the attribute.
        /// </param>
        /// <param name="attrString">Value of the attribute as a string.
        ///
        /// @throws IllegalArgumentException if attrName or attrString is null
        /// </param>
        public LdapAttribute(string attrName, string attrString) : this(attrName)
        {
            if ((object)attrString == null)
            {
                throw new ArgumentException("Attribute value cannot be null");
            }
            try
            {
                System.Text.Encoding encoder = System.Text.Encoding.GetEncoding("utf-8");
                byte[]  ibytes = encoder.GetBytes(attrString);
                sbyte[] sbytes = SupportClass.ToSByteArray(ibytes);

                add(sbytes);
            }
            catch (System.IO.IOException e)
            {
                throw new Exception(e.ToString());
            }
        }
Пример #3
0
        /// <summary> Adds a string value to the attribute.
        ///
        /// </summary>
        /// <param name="attrString">Value of the attribute as a String.
        ///
        /// @throws IllegalArgumentException if attrString is null
        /// </param>
        public virtual void  addValue(System.String attrString)
        {
            if ((System.Object)attrString == null)
            {
                throw new System.ArgumentException("Attribute value cannot be null");
            }
            try
            {
                System.Text.Encoding encoder = System.Text.Encoding.GetEncoding("utf-8");
                byte[]  ibytes = encoder.GetBytes(attrString);
                sbyte[] sbytes = SupportClass.ToSByteArray(ibytes);
                this.add(sbytes);
//				this.add(attrString.getBytes("UTF-8"));
            }
            catch (System.IO.IOException ue)
            {
                throw new System.Exception(ue.ToString());
            }
            return;
        }
Пример #4
0
 /// <summary> Removes a string value from the attribute.
 ///
 /// </summary>
 /// <param name="attrString">  Value of the attribute as a string.
 ///
 /// Note: Removing a value which is not present in the attribute has
 /// no effect.
 ///
 /// @throws IllegalArgumentException if attrString is null
 /// </param>
 public virtual void removeValue(string attrString)
 {
     if (attrString == null)
     {
         throw new ArgumentException("Attribute value cannot be null");
     }
     try
     {
         Encoding encoder = Encoding.GetEncoding("utf-8");
         byte[]   ibytes  = encoder.GetBytes(attrString);
         sbyte[]  sbytes  = SupportClass.ToSByteArray(ibytes);
         this.removeValue(sbytes);
         //				this.removeValue(attrString.getBytes("UTF-8"));
     }
     catch (IOException uee)
     {
         // This should NEVER happen but just in case ...
         throw new SystemException(uee.ToString());
     }
 }
Пример #5
0
        /// <summary> Removes a string value from the attribute.
        ///
        /// </summary>
        /// <param name="attrString">  Value of the attribute as a string.
        ///
        /// Note: Removing a value which is not present in the attribute has
        /// no effect.
        ///
        /// @throws IllegalArgumentException if attrString is null
        /// </param>
        public virtual void  removeValue(System.String attrString)
        {
            if (null == (System.Object)attrString)
            {
                throw new System.ArgumentException("Attribute value cannot be null");
            }
            try
            {
                System.Text.Encoding encoder = System.Text.Encoding.GetEncoding("utf-8");
                byte[]  ibytes = encoder.GetBytes(attrString);
                sbyte[] sbytes = SupportClass.ToSByteArray(ibytes);
                this.removeValue(sbytes);
//				this.removeValue(attrString.getBytes("UTF-8"));
            }
            catch (System.IO.IOException uee)
            {
                // This should NEVER happen but just in case ...
                throw new System.Exception(uee.ToString());
            }
            return;
        }