public abstract class TransportIpAddress extends IpAddress
TransportIpAddress
is the abstract base class for all
transport addresses on top of IP network addresses.Modifier and Type | Field and Description |
---|---|
protected int |
port |
ANY_IPADDRESS
SMISYNTAXES_PROPERTIES
Constructor and Description |
---|
TransportIpAddress() |
Modifier and Type | Method and Description |
---|---|
int |
compareTo(Variable o) |
void |
decodeBER(BERInputStream inputStream)
Decodes a
Variable from an BERInputStream . |
void |
encodeBER(OutputStream outputStream)
Encodes a
Variable to an OutputStream . |
boolean |
equals(Object o) |
int |
getBERLength()
Returns the length of this
Variable in bytes when encoded
according to the Basic Encoding Rules (BER). |
int |
getBERPayloadLength()
Returns the length of the payload of this
BERSerializable object
in bytes when encoded according to the Basic Encoding Rules (BER). |
int |
getPort() |
int |
getSyntax()
Gets the ASN.1 syntax identifier value of this SNMP variable.
|
byte[] |
getValue()
Returns the address value as a byte array.
|
int |
hashCode() |
boolean |
isValid()
Checks whether this
Address is a valid transport address. |
static Address |
parse(String address) |
boolean |
parseAddress(String address)
Parses the address from the supplied string representation.
|
void |
setPort(int port) |
void |
setTransportAddress(OctetString transportAddress)
Sets this transport address from an OcetString containing the address
value in format as specified by the TRANSPORT-ADDRESS-MIB.
|
String |
toString()
Gets a string representation of the variable.
|
clone, fromSubIndex, getInetAddress, setAddress, setInetAddress, setValue, setValue, toByteArray, toInt, toLong, toSubIndex
createFromBER, createFromSyntax, equal, getSyntaxFromString, getSyntaxString, getSyntaxString, isDynamic, isException
public int getPort()
public void setPort(int port)
public boolean isValid()
Address
Address
is a valid transport address.public int compareTo(Variable o)
public boolean equals(Object o)
public boolean parseAddress(String address)
Address
parseAddress
in interface Address
parseAddress
in class IpAddress
address
- a String representation of this address.true
if address
could be successfully
parsed and has been assigned to this address object, false
otherwise.public String toString()
AbstractVariable
public int hashCode()
public void setTransportAddress(OctetString transportAddress) throws UnknownHostException
transportAddress
- an OctetString containing the IP address bytes and the two port bytes
in network byte order.UnknownHostException
- if the address is invalid.public byte[] getValue()
public void decodeBER(BERInputStream inputStream) throws IOException
AbstractVariable
Variable
from an BERInputStream
.decodeBER
in interface BERSerializable
decodeBER
in class IpAddress
inputStream
- an BERInputStream
containing a BER encoded byte stream.IOException
- if the stream could not be decoded by using BER rules.public void encodeBER(OutputStream outputStream) throws IOException
AbstractVariable
Variable
to an OutputStream
.encodeBER
in interface BERSerializable
encodeBER
in class IpAddress
outputStream
- an OutputStream
.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 IpAddress
public int getBERPayloadLength()
BERSerializable
BERSerializable
object
in bytes when encoded according to the Basic Encoding Rules (BER).getBERPayloadLength
in interface BERSerializable
getBERPayloadLength
in class AbstractVariable
public int getSyntax()
AbstractVariable
Copyright © 2022 SNMP4J.org. All rights reserved.