|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.snmp4j.smi.AbstractVariable
org.snmp4j.smi.SMIAddress
org.snmp4j.smi.GenericAddress
public class GenericAddress
The GenericAddress implements the decorator and factory
design pattern to provide a generic address type.
To register address types other than the default, set the system property
ADDRESS_TYPES_PROPERTIES before calling the parse(java.lang.String) method
for the first time.
| Field Summary | |
|---|---|
static java.lang.String |
ADDRESS_TYPES_PROPERTIES
|
static java.lang.String |
TYPE_IP
Default address type identifier for an IpAddress. |
static java.lang.String |
TYPE_TCP
Default address type identifier for a TcpAddress. |
static java.lang.String |
TYPE_UDP
Default address type identifier for an UpdAddress. |
| Fields inherited from class org.snmp4j.smi.AbstractVariable |
|---|
SMISYNTAXES_PROPERTIES |
| Constructor Summary | |
|---|---|
GenericAddress()
|
|
GenericAddress(SMIAddress address)
|
|
| Method Summary | |
|---|---|
java.lang.Object |
clone()
Clones this variable. |
int |
compareTo(java.lang.Object o)
|
void |
decodeBER(BERInputStream inputStream)
Decodes a Variable from an InputStream. |
void |
encodeBER(java.io.OutputStream outputStream)
Encodes a Variable to an OutputStream. |
boolean |
equals(java.lang.Object o)
|
void |
fromSubIndex(OID subIndex,
boolean impliedLength)
Sets the value of this Variable from the supplied (sub-)index. |
Address |
getAddress()
|
int |
getBERLength()
Returns the length of this Variable in bytes when encoded
according to the Basic Encoding Rules (BER). |
int |
getSyntax()
Gets the ASN.1 syntax identifier value of this SNMP variable. |
int |
hashCode()
|
boolean |
isValid()
Checks whether this Address is a valid transport address. |
static Address |
parse(java.lang.String address)
Parses a given transport protocol dependent address string into an Address instance that is subsumed by this
GenericAddress object. |
boolean |
parseAddress(java.lang.String address)
Parse an address form the supplied string. |
void |
setAddress(SMIAddress address)
|
void |
setValue(java.lang.String value)
Sets the address value from the supplied String. |
int |
toInt()
Returns an integer representation of this variable if such a representation exists. |
long |
toLong()
Returns a long representation of this variable if such a representation exists. |
java.lang.String |
toString()
Gets a string representation of the variable. |
OID |
toSubIndex(boolean impliedLength)
Converts the value of this Variable to a (sub-)index
value. |
| Methods inherited from class org.snmp4j.smi.AbstractVariable |
|---|
createFromBER, createFromSyntax, getBERPayloadLength, getSyntaxFromString, getSyntaxString, getSyntaxString, isDynamic, isException |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String TYPE_UDP
public static final java.lang.String TYPE_TCP
public static final java.lang.String TYPE_IP
public static final java.lang.String ADDRESS_TYPES_PROPERTIES
| Constructor Detail |
|---|
public GenericAddress()
public GenericAddress(SMIAddress address)
| Method Detail |
|---|
public int getSyntax()
AbstractVariable
getSyntax in interface VariablegetSyntax in class AbstractVariablepublic boolean isValid()
AddressAddress is a valid transport address.
true if the address is valid, false otherwise.public java.lang.String toString()
AbstractVariable
toString in interface VariabletoString in class AbstractVariablepublic int hashCode()
hashCode in interface VariablehashCode in class AbstractVariablepublic int compareTo(java.lang.Object o)
compareTo in interface java.lang.ComparablecompareTo in interface VariablecompareTo in class AbstractVariablepublic boolean equals(java.lang.Object o)
equals in interface Variableequals in class AbstractVariable
public void decodeBER(BERInputStream inputStream)
throws java.io.IOException
AbstractVariableVariable from an InputStream.
decodeBER in interface BERSerializabledecodeBER in class AbstractVariableinputStream - an InputStream containing a BER encoded byte stream.
java.io.IOException - if the stream could not be decoded by using BER rules.
public void encodeBER(java.io.OutputStream outputStream)
throws java.io.IOException
AbstractVariableVariable to an OutputStream.
encodeBER in interface BERSerializableencodeBER in class AbstractVariableoutputStream - an OutputStream.
java.io.IOException - if an error occurs while writing to the stream.public int getBERLength()
AbstractVariableVariable in bytes when encoded
according to the Basic Encoding Rules (BER).
getBERLength in interface BERSerializablegetBERLength in class AbstractVariablepublic void setAddress(SMIAddress address)
public Address getAddress()
public static Address parse(java.lang.String address)
Address instance that is subsumed by this
GenericAddress object.
address - an address string with a leading type specifier as defined in the
"address.properties". The format is "type:address" where
the format of address depends on type.
Valid values for type are, for example, "udp" and "tcp".
Address instance of the address classes specified
in "address.properties" whose type ID matched the specified ID in
address. If address cannot be parsed,
null is returned.
java.lang.IllegalArgumentException - if the address type indicator supplied is not know.public boolean parseAddress(java.lang.String address)
address - an address string known by the GenericAddress.
parse(String address)public java.lang.Object clone()
Variable
clone in interface Variableclone in class AbstractVariableVariable with the same value.public int toInt()
AbstractVariable
toInt in interface VariabletoInt in class AbstractVariablepublic long toLong()
AbstractVariable
toLong in interface VariabletoLong in class AbstractVariablepublic OID toSubIndex(boolean impliedLength)
AbstractVariableVariable to a (sub-)index
value.
toSubIndex in interface VariabletoSubIndex in class AbstractVariableimpliedLength - specifies if the sub-index has an implied length. This parameter applies
to variable length variables only (e.g. OctetString and
OID). For other variables it has no effect.
public void fromSubIndex(OID subIndex,
boolean impliedLength)
AbstractVariableVariable from the supplied (sub-)index.
fromSubIndex in interface VariablefromSubIndex in class AbstractVariablesubIndex - the sub-index OID.impliedLength - specifies if the sub-index has an implied length. This parameter applies
to variable length variables only (e.g. OctetString and
OID). For other variables it has no effect.public void setValue(java.lang.String value)
AddressIllegalArgumentException runtime exception is thrown.
value - an address String.
|
Copyright 2003-2009 Frank Fock and Jochen Katz (SNMP4J.org) | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||