Package uk.co.westhawk.snmp.stack
Class BitsHelper
java.lang.Object
uk.co.westhawk.snmp.stack.BitsHelper
This class help with the BITS construct. The AsnOctets class is
growing too big, because of all the different representations.
Note that BITS is different from the ANS.1 BIT STRING. Apparently BIT
STRING was in v1, but was depreceated in favour of BITS.
An instance with bits 0, 3 and 10 set will have the value: 10010000 00100000 ^ ^ ^ bit 0 3 10 so will consist of the two bytes (octets) 0x90 & 0x20.See also section 7.1.4. of SNMPv2-SMI and section 8. (3) of SNMPv2-TM.
- Since:
- 5_0
- Version:
- $Revision: 3.1 $ $Date: 2006/03/23 15:09:48 $
- Author:
- Birgit Arkesteijn
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
Returns if the flag (bit) on the specified index is set.static void
setFlagged
(AsnOctets oct, int index, boolean toset) Sets or unsets the flag (bit) on the specified index.
-
Constructor Details
-
BitsHelper
public BitsHelper()
-
-
Method Details
-
setFlagged
public static void setFlagged(AsnOctets oct, int index, boolean toset) throws IllegalArgumentException Sets or unsets the flag (bit) on the specified index. The bit will be set to zero if toset is false, set to one if toset is true. Note, as a side effect the size of the asn octet might grow.- Parameters:
oct
- The AsnOctets that represents the BITSindex
- The index (0 - X)toset
- Whether to set (true) or unset (false) the bit- Throws:
IllegalArgumentException
-
isFlagged
Returns if the flag (bit) on the specified index is set. The bit will be set to zero if toset is false, set to one if toset is true.- Parameters:
oct
- The AsnOctets that represents the BITSindex
- The index (0 - X)- Returns:
- Whether the bit is set (true) or unset (false)
- Throws:
IllegalArgumentException
-