Novell.Directory.Ldap.Asn1.Asn1Structured.toArray C# (CSharp) Method

toArray() public method

Returns an array containing the individual ASN.1 elements of this Asn1Structed object.
public toArray ( ) : Novell.Directory.Ldap.Asn1.Asn1Object[]
return Novell.Directory.Ldap.Asn1.Asn1Object[]
        public Asn1Object[] toArray()
        {
            Asn1Object[] cloneArray = new Asn1Object[contentIndex];
            Array.Copy((System.Array) content, 0, (System.Array) cloneArray, 0, contentIndex);
            return cloneArray;
        }

Usage Example

Example #1
0
        /* Asn1 TYPE NOT YET SUPPORTED
         * Encode an Asn1ObjectIdentifier directly to a stream.
         * public void encode(Asn1ObjectIdentifier oi, OutputStream out)
         * throws IOException
         * {
         * throw new IOException("LBEREncoder: Encode to a stream not implemented");
         * }
         */

        /* Asn1 TYPE NOT YET SUPPORTED
         * Encode an Asn1CharacterString directly to a stream.
         * public void encode(Asn1CharacterString cs, OutputStream out)
         * throws IOException
         * {
         * throw new IOException("LBEREncoder: Encode to a stream not implemented");
         * }
         */

        /* Encoders for ASN.1 structured types
         */

        /// <summary> Encode an Asn1Structured into the specified outputstream.  This method
        /// can be used to encode SET, SET_OF, SEQUENCE, SEQUENCE_OF
        /// </summary>
        public void encode(Asn1Structured c, System.IO.Stream out_Renamed)
        {
            encode(c.getIdentifier(), out_Renamed);

            Asn1Object[] value_Renamed = c.toArray();

            MemoryStream output = new MemoryStream();

            /* Cycle through each element encoding each element */
            for (int i = 0; i < value_Renamed.Length; i++)
            {
                (value_Renamed[i]).encode(this, output);
            }

            /* Encode the length */
            encodeLength((int)output.Length, out_Renamed);

            /* Add each encoded element into the output stream */
            sbyte[] temp_sbyteArray;
            temp_sbyteArray = SupportClass.ToSByteArray(output.ToArray());
            out_Renamed.Write(SupportClass.ToByteArray(temp_sbyteArray), 0, temp_sbyteArray.Length);;;
        }
All Usage Examples Of Novell.Directory.Ldap.Asn1.Asn1Structured::toArray