|
SNMP Stack 4_12 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--uk.co.westhawk.snmp.stack.AsnObject
|
+--uk.co.westhawk.snmp.stack.AsnOctets
This class represents the ASN.1 Octet class. It can be used for Octets, Ip Addresses and Opaque types.
| Field Summary | |
static java.lang.String |
HEX_PREFIX
The hexadecimal prefix that is used when printing a hexadecimal number in toString(). |
| Fields inherited from class uk.co.westhawk.snmp.stack.AsnObject |
contentsLength, debug, headerLength, isCorrect, startPos, type |
| Constructor Summary | |
AsnOctets(byte[] s)
Constructor. |
|
AsnOctets(byte[] s,
byte t)
Constructor to create a specific type of AsnOctets. |
|
AsnOctets(char[] s)
Constructor. |
|
AsnOctets(java.net.InetAddress iad)
Constructor to create an ASN IP Address. |
|
AsnOctets(java.io.InputStream in,
int len)
Constructor. |
|
AsnOctets(java.lang.String s)
Constructor. |
|
| Method Summary | |
boolean |
equals(java.lang.Object anObject)
Compares this Octet to the specified object. |
byte[] |
getBytes()
Returns the bytes. |
java.lang.String |
getValue()
Returns the value. |
int |
hashCode()
Returns a hash code for this Octet. |
static void |
setHexPrefix(java.lang.String newPrefix)
Set the global hexadecimal prefix. |
java.lang.String |
toDisplayString()
Returns this object as a display string. |
java.lang.String |
toHex()
Returns this object as an hexadecimal. |
java.lang.String |
toIpAddress()
Returns this object as an IP Address. |
java.lang.String |
toString()
Returns the string representation of the AsnOctets. |
long[] |
toSubOid(boolean length_implied)
Converts this object to its corresponding sub-identifiers. |
| Methods inherited from class uk.co.westhawk.snmp.stack.AsnObject |
getRespType, getRespTypeString, setDebug |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static java.lang.String HEX_PREFIX
| Constructor Detail |
public AsnOctets(char[] s)
s - The character array representing the AsnOctetsSnmpConstants.ASN_OCTET_STRpublic AsnOctets(java.lang.String s)
s - The string representing the AsnOctetsSnmpConstants.ASN_OCTET_STR
public AsnOctets(byte[] s)
throws java.lang.IllegalArgumentException
s - The byte array representing the AsnOctetsSnmpConstants.ASN_OCTET_STR
public AsnOctets(java.net.InetAddress iad)
throws java.lang.IllegalArgumentException
iad - The Inet Address representing the AsnIPAddressInetAddress,
AsnOctets(byte[], byte)
public AsnOctets(byte[] s,
byte t)
throws java.lang.IllegalArgumentException
s - The byte array representing the AsnOctetst - The type of the AsnOctetsSnmpConstants.ASN_OCTET_STR,
SnmpConstants.IPADDRESS,
SnmpConstants.OPAQUE
public AsnOctets(java.io.InputStream in,
int len)
throws java.io.IOException
in - The input stream from which the value should be readlen - The length of the AsnOctets| Method Detail |
public static void setHexPrefix(java.lang.String newPrefix)
toString(),
toHex(),
HEX_PREFIXpublic java.lang.String getValue()
toString()public byte[] getBytes()
public java.lang.String toString()
The string will have one of the following formats:
When the type is ASN_OCTET_STR, the method tries to guess whether or not the string is printable; without the knowledge of the MIB it cannot distinguish between OctetString and DisplayString.
toString in class AsnObjectHEX_PREFIX,
setHexPrefix(String),
toHex(),
toIpAddress(),
toDisplayString()public java.lang.String toIpAddress()
toString()public java.lang.String toHex()
toString()public java.lang.String toDisplayString()
toString()public long[] toSubOid(boolean length_implied)
Use this method when building an OID when this object specifies a conceptual row. For example ipNetToMediaEntry, see RFC 2011 or SnmpCommunityEntry, see RFC 2576
The variable length_implied indicates that this MIB variable
is preceded by the IMPLIED keyword.
Note that the IMPLIED keyword can only be present for an object having
a variable-length syntax (e.g., variable-length strings or object
identifier-valued objects). Further, the IMPLIED keyword can only be
associated with the last object in the INDEX clause. Finally, the
IMPLIED keyword may not be used on a variable-length string object if
that string might have a value of zero-length.
If the length is implied, no extra sub-identifier will be created to indicate its length. If the length is not implied, the first sub-identifier will be the length of the Octet.
If this object is of type IPADDRESS, length_implied should be false.
The mapping of the INDEX clause is explained in RFC 2578, section 7.7.
length_implied - Indicates if the length of this octet is
implied.AsnObjectId.add(long[])public boolean equals(java.lang.Object anObject)
true if and only if the argument is not
null and is a AsnOctets object that represents
the same sequence of octets as this object.equals in class java.lang.ObjectanObject - the object to compare this AsnOctets
against.true if the AsnOctets are equal;
false otherwise.public int hashCode()
AsnOctets object is computed as
usings[0]*31^(n-1) + s[1]*31^(n-2) + ... + s[n-1]
int arithmetic, where s[i] is the
ith character of the Octet, n is the length of
the Octet, and ^ indicates exponentiation.
(The hash value of the empty Octet is zero.)hashCode in class java.lang.Object
|
SNMP Stack 4_12 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||