|
||||||||||
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 Variable
getSyntax
in class AbstractVariable
public boolean isValid()
Address
Address
is a valid transport address.
true
if the address is valid, false
otherwise.public java.lang.String toString()
AbstractVariable
toString
in interface Variable
toString
in class AbstractVariable
public int hashCode()
hashCode
in interface Variable
hashCode
in class AbstractVariable
public int compareTo(java.lang.Object o)
compareTo
in interface java.lang.Comparable
compareTo
in interface Variable
compareTo
in class AbstractVariable
public boolean equals(java.lang.Object o)
equals
in interface Variable
equals
in class AbstractVariable
public void decodeBER(BERInputStream inputStream) throws java.io.IOException
AbstractVariable
Variable
from an InputStream
.
decodeBER
in interface BERSerializable
decodeBER
in class AbstractVariable
inputStream
- 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
AbstractVariable
Variable
to an OutputStream
.
encodeBER
in interface BERSerializable
encodeBER
in class AbstractVariable
outputStream
- an OutputStream
.
java.io.IOException
- if an error occurs while writing to the stream.public int getBERLength()
AbstractVariable
Variable
in bytes when encoded
according to the Basic Encoding Rules (BER).
getBERLength
in interface BERSerializable
getBERLength
in class AbstractVariable
public 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 Variable
clone
in class AbstractVariable
Variable
with the same value.public int toInt()
AbstractVariable
toInt
in interface Variable
toInt
in class AbstractVariable
public long toLong()
AbstractVariable
toLong
in interface Variable
toLong
in class AbstractVariable
public OID toSubIndex(boolean impliedLength)
AbstractVariable
Variable
to a (sub-)index
value.
toSubIndex
in interface Variable
toSubIndex
in class AbstractVariable
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 fromSubIndex(OID subIndex, boolean impliedLength)
AbstractVariable
Variable
from the supplied (sub-)index.
fromSubIndex
in interface Variable
fromSubIndex
in class AbstractVariable
subIndex
- 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)
Address
IllegalArgumentException
runtime exception is thrown.
value
- an address String.
|
Copyright 2005-2010 Frank Fock (SNMP4J.org) | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |