Objective Systems, Inc.  
Home
About ASN.1
Products
Free Software
Open Source
Documents
Services
Resources
Resellers
Customers
Careers
About Us
Contact Us
 

Google


Objective Systems, Inc.

Asn1BitString Class Reference

Inheritance diagram for Asn1BitString:

Asn1Type Asn1TypeIF List of all members.

Detailed Description

This is a container class for holding the components of an ASN.1 bit string value.


Public Member Functions

 Asn1BitString (System.Collections.BitArray bitArray)
 Asn1BitString (System.String value_)
 Asn1BitString (bool[] bitValues)
 Asn1BitString (int numbits_, byte[] data)
 Asn1BitString ()
virtual void Clear (int bitno)
virtual void Decode (Asn1PerDecodeBuffer buffer, long lower, long upper)
override void Decode (Asn1PerDecodeBuffer buffer)
override void Decode (Asn1BerDecodeBuffer buffer, bool explicitTagging, int implicitLength)
virtual void DecodeXER (System.String buffer, System.String attrs)
virtual void DecodeXML (System.String buffer, System.String attrs)
virtual void Encode (Asn1PerOutputStream outs, long lower, long upper)
override void Encode (Asn1PerOutputStream outs)
override void Encode (Asn1BerOutputStream outs, bool explicitTagging)
override void Encode (Asn1XerEncoder buffer, System.String elemName, System.String attribute)
virtual void Encode (Asn1XerEncoder buffer, System.String elemName, System.String attribute, System.String[] namedbits, int[] namedbitindex)
override void Encode (Asn1XerEncoder buffer, System.String elemName)
virtual void Encode (Asn1PerEncodeBuffer buffer, long lower, long upper)
override void Encode (Asn1PerEncodeBuffer buffer)
override int Encode (Asn1BerEncodeBuffer buffer, bool explicitTagging)
override bool Equals (System.Object value)
virtual bool Equals (int nbits, byte[] value)
virtual bool Get (int bitno)
override int GetHashCode ()
virtual bool IsNamedBitStr (System.String buffer)
virtual void Set (int bitno)
virtual void Set (int bitno, bool value)
virtual bool[] ToBoolArray ()
virtual System.String ToHexString ()
override System.String ToString ()

Public Attributes

byte[] mValue
int numbits

Static Public Attributes

static new readonly Asn1Tag _TAG

Properties

override int Length
virtual bool this [int bitno]


Constructor & Destructor Documentation

Asn1BitString  ) 
 

This constructor creates an empty bit string that can be used in a Decode method call to receive a bit string value.

Asn1BitString int  numbits_,
byte[]  data
 

This constructor initializes a bit string with the given number of bits and data.

Parameters:
numbits_ Number of bits
data Binary bit string contents

Asn1BitString bool[]  bitValues  ) 
 

This constructor initializes a bit string from the given boolean array. Each array position corresponds to a bit in the bit string.

Parameters:
bitValues The boolean array

Asn1BitString System.String  value_  ) 
 

This constructor parses the given ASN.1 value text (either a binary or hex data string) and assigns the values to the internal bit string.

Examples of valid value formats are as follows:

Binary string: '11010010111001'B

Hex string: '0fa56920014abc'H

Parameters:
value_ The ASN.1 value specification text

Asn1BitString System.Collections.BitArray  bitArray  ) 
 

This constructor initializes a bit string from the given BitSet object.

Parameters:
bitArray C# BitArray object


Member Function Documentation

virtual void Clear int  bitno  )  [virtual]
 

This method clears the given bit in the bit string.

Parameters:
bitno The zero-based index of the bit to clear. The bit numbers start at zero and with the MSB of the first byte and progress from left to right.

virtual void Decode Asn1PerDecodeBuffer  buffer,
long  lower,
long  upper
[virtual]
 

This method decodes a sized ASN.1 bit string value using the packed encoding rules (PER).

Parameters:
buffer Decode message buffer object
lower Lower bound (inclusive) of size constraint
upper Upper bound (inclusive) of size constraint

override void Decode Asn1PerDecodeBuffer  buffer  )  [virtual]
 

This method decodes an ASN.1 bit string value using the packed encoding rules (PER). The string is assumed to not contain a size constraint.

Parameters:
buffer Decode message buffer object

Reimplemented from Asn1Type.

override void Decode Asn1BerDecodeBuffer  buffer,
bool  explicitTagging,
int  implicitLength
[virtual]
 

This method decodes an ASN.1 bit string value using the BER or DER encoding rules. The UNIVERSAL tag value and length are decoded if explicit tagging is specified.

Parameters:
buffer Decode message buffer object
explicitTagging Flag indicating element is explicitly tagged
implicitLength Length of contents if implicit

Reimplemented from Asn1Type.

virtual void DecodeXER System.String  buffer,
System.String  attrs
[virtual]
 

This method decodes ASN.1 bit string type using the XML encoding rules (XER).

Parameters:
buffer String containing data to be decoded
attrs Attributes string from element tag

virtual void DecodeXML System.String  buffer,
System.String  attrs
[virtual]
 

This method decodes ASN.1 bit string type using the XML decoding as specified in the XML Schema standard.

Parameters:
buffer String containing data to be decoded
attrs Attributes string from element tag

virtual void Encode Asn1PerOutputStream  outs,
long  lower,
long  upper
[virtual]
 

This method encodes a size-constrained ASN.1 bit string value using the packed encoding rules (PER) into the stream. The value to be encoded is stored in the 'numbits' and 'mValue' public member variables within this class.

Also throws any exception thrown by the underlying Asn1PerOutputStream.

Parameters:
outs PER Output Stream object
lower Lower bound (inclusive) of size constraint
upper Upper bound (inclusive) of size constraint
Exceptions:
Asn1Exception Thrown, if operation is failed.

override void Encode Asn1PerOutputStream  outs  )  [virtual]
 

This method encodes an unconstrained ASN.1 bit string value using the packed encoding rules (PER)into the stream. The value to be encoded is stored in the 'numbits' and 'mValue' public member variables within this class.

Also throws any exception thrown by the underlying Asn1PerOutputStream.

Parameters:
outs PER Output Stream object
Exceptions:
Asn1Exception Thrown, if operation is failed.

Reimplemented from Asn1Type.

override void Encode Asn1BerOutputStream  outs,
bool  explicitTagging
[virtual]
 

This method encodes and writes to the stream an ASN.1 bit string value including the UNIVERSAL tag value and length if explicit tagging is specified. This overloaded version uses the Basic Encoding Rules (BER).

Throws, exception thrown by the underlying System.IO.Stream object.

Parameters:
outs BER Output Stream object
explicitTagging Flag indicating explicit tagging should be done
Exceptions:
Asn1Exception Thrown, if operation is failed.

Reimplemented from Asn1Type.

override void Encode Asn1XerEncoder  buffer,
System.String  elemName,
System.String  attribute
[virtual]
 

This method encodes ASN.1 bit string type using the XML Encoding as specified in the XML Schema standard.

Parameters:
buffer Encode message buffer object
elemName XML element name used to wrap string
attribute XML element attribute name

Reimplemented from Asn1Type.

virtual void Encode Asn1XerEncoder  buffer,
System.String  elemName,
System.String  attribute,
System.String[]  namedbits,
int[]  namedbitindex
[virtual]
 

This method encodes ASN.1 bit string type using the XML Encoding as specified in the XML Schema standard.

Parameters:
buffer Encode message buffer object
elemName XML element name used to wrap string
attribute XML element attribute name
namedbits Array of named bits
namedbitindex Arrat of named bits index values

override void Encode Asn1XerEncoder  buffer,
System.String  elemName
[virtual]
 

This method encodes ASN.1 bit string type using the XML encoding rules (XER).

Parameters:
buffer Encode message buffer object
elemName XML element name used to wrap string

Reimplemented from Asn1Type.

virtual void Encode Asn1PerEncodeBuffer  buffer,
long  lower,
long  upper
[virtual]
 

This method encodes a size-constrained ASN.1 bit string value using the packed encoding rules (PER). The value to be encoded is stored in the 'numbits' and 'mValue' public member variables within this class.

Parameters:
buffer Encode message buffer object
lower Lower bound (inclusive) of size constraint
upper Upper bound (inclusive) of size constraint

override void Encode Asn1PerEncodeBuffer  buffer  )  [virtual]
 

This method encodes an unconstrained ASN.1 bit string value using the packed encoding rules (PER). The value to be encoded is stored in the 'numbits' and 'mValue' public member variables within this class.

Parameters:
buffer Encode message buffer object

Reimplemented from Asn1Type.

override int Encode Asn1BerEncodeBuffer  buffer,
bool  explicitTagging
[virtual]
 

This method encodes an ASN.1 bit string value using the BER or DER encoding rules. The UNIVERSAL tag value and length are encoded if explicit tagging is specified.

Parameters:
buffer Encode message buffer object
explicitTagging Flag indicating explicit tagging should be done
Returns:
Length of component or negative status value

Reimplemented from Asn1Type.

override bool Equals System.Object  value  ) 
 

This method compares this bit string value to the given value for equality. This method assumes all unused bits in the last byte are set to zero.

Parameters:
value The Object to compare with the current Object. Object should be instance of Asn1BitString.
Returns:
true if the specified Object is equal to the current Object; otherwise, false.

virtual bool Equals int  nbits,
byte[]  value
[virtual]
 

This method compares this bit string value to the given value for equality. This method assumes all unused bits in the last byte are set to zero.

Parameters:
nbits The number of bits to compare from the byte array.
value The byte array to compare with the current Object.
Returns:
true if the specified bit array is equal to the current Object; otherwise, false.

virtual bool Get int  bitno  )  [virtual]
 

Gets the value of the bit at a specific position in the bit array.

Parameters:
bitno The zero-based index of the bit to get. The bit numbers start at zero and with the MSB of the first byte and progress from left to right.
Returns:
true if bit is set; otherwise false.

override int GetHashCode  ) 
 

Serves as a hash function for a particular type, suitable for use in hashing algorithms and data structures like a hash table.

Returns:
A hash code for the current Object.

virtual bool IsNamedBitStr System.String  buffer  )  [virtual]
 

This method determines is the input character string represented as named bit string or as bits sequence. It is used for XML decoding.

Parameters:
buffer Bit string as string to be tested.
Returns:
true, if bit string is represented as sequnece of identifiers.

virtual void Set int  bitno  )  [virtual]
 

This method will set the given bit number to one (1). It will expand the existing bit array if it needs to.

Parameters:
bitno The zero-based index of the bit to set. The bit numbers start at zero and with the MSB of the first byte and progress from left to right.

virtual void Set int  bitno,
bool  value
[virtual]
 

This method sets the given bit number in the bit string with given value. It will expand the existing bit array if it needs to.

Parameters:
bitno The zero-based index of the bit to set. The bit numbers start at zero and with the MSB of the first byte and progress from left to right.
value The Boolean value to assign to the bit.

virtual bool [] ToBoolArray  )  [virtual]
 

This method converts the bit string stored in this object to a boolean array.

Returns:
Boolean array value

virtual System.String ToHexString  )  [virtual]
 

This method will return a hex string representation of the bit string value. The output format is a string of hex bytes with no extra delimiting characters (ex. 0D56EF).

Returns:
Stringified representation of the value

override System.String ToString  ) 
 

This method will return a string representation of the bit string value. The output format is a string of 1's and 0's with no extra delimiting characters (ex. 010011).

Returns:
Stringified representation of the value


Member Data Documentation

new readonly Asn1Tag _TAG [static]
 

The _TAG constant describes the universal tag for this data type (UNIVERSAL 3).

Reimplemented from Asn1Type.

byte [] mValue
 

This variable holds the bit string value. These are the bits that are encoded when encode is invoked. It is also where the decoded bit string is stored after a Decode operation.

int numbits
 

This variable contains the number of bits in the bit string value.


Property Documentation

override int Length [get]
 

Gets the length of the BIT STRING in bits.

Value: Number of bits.

Reimplemented from Asn1Type.

virtual bool this[int bitno] [get, set]
 

Gets or Sets the given bit in the bit string. It will expand the existing bit array if it needs to set the bit value.

Parameters:
bitno The position of the bit in bit array
Value: true if bit is set; otherwise false.


Copyright © 1997-2005 Objective Systems,Inc.
All Rights Reserved.
This document may be distributed in any form, electronic
or otherwise, provided that it is distributed in its entirety
and that the copyright and this notice are included.

This file was last modified on 18 Nov 2005.
ASN1C C# Runtime Library, 5.8