public class HostAddress
extends java.lang.Object
implements org.apache.directory.api.asn1.Asn1Object
HostAddress ::= SEQUENCE {
addr-type [0] Int32,
address [1] OCTET STRING
}
| Modifier and Type | Field and Description |
|---|---|
private byte[] |
address
The address
|
private int |
addressLength |
private HostAddrType |
addrType
The host address type.
|
private int |
addrTypeLength |
private int |
hostAddressLength |
private int |
hostAddressSeqLength |
private static boolean |
IS_DEBUG
Speedup for logs
|
private static org.slf4j.Logger |
LOG
The logger
|
| Constructor and Description |
|---|
HostAddress()
Creates an empty HostAdress instance
|
HostAddress(HostAddrType addrType,
byte[] address)
Creates a new instance of HostAddress.
|
HostAddress(java.net.InetAddress internetAddress)
Creates a new instance of HostAddress.
|
| Modifier and Type | Method and Description |
|---|---|
int |
computeLength()
Compute the host address length
|
java.nio.ByteBuffer |
encode(java.nio.ByteBuffer buffer)
Encode the HostAddress message to a PDU.
|
boolean |
equals(java.lang.Object that)
Returns whether one
HostAddress is equal to another. |
byte[] |
getAddress()
Get the bytes for this address.
|
HostAddrType |
getAddrType()
Returns the
HostAddrType of this HostAddress. |
int |
hashCode() |
void |
setAddress(byte[] addresse)
Set the address
|
void |
setAddrType(HostAddrType addrType)
Set the addr-type field
|
void |
setAddrType(int addrType)
Set the addr-type field
|
java.lang.String |
toString() |
private static final org.slf4j.Logger LOG
private static final boolean IS_DEBUG
private HostAddrType addrType
private byte[] address
private int addrTypeLength
private int addressLength
private int hostAddressLength
private int hostAddressSeqLength
public HostAddress()
public HostAddress(HostAddrType addrType, byte[] address)
addrType - The type of addressaddress - The addresspublic HostAddress(java.net.InetAddress internetAddress)
internetAddress - The Inet form addresspublic int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object that)
HostAddress is equal to another.equals in class java.lang.Objectthat - The HostAddress to compare withHostAddress's are equal.public byte[] getAddress()
public void setAddress(byte[] addresse)
addresse - The addresspublic int computeLength()
HostAddress :
0x30 L1 hostAddress sequence
|
+--> 0xA0 L2 addrType tag
| |
| +--> 0x02 L2-1 addrType (int)
|
+--> 0xA1 L3 address tag
|
+--> 0x04 L3-1 address (OCTET STRING)
where L1 = L2 + length(0xA0) + length(L2) +
L3 + length(0xA1) + length(L3)
and
L2 = L2-1 + length(0x02) + length( L2-1)
L3 = L3-1 + length(0x04) + length( L3-1)
computeLength in interface org.apache.directory.api.asn1.Asn1Objectpublic java.nio.ByteBuffer encode(java.nio.ByteBuffer buffer)
throws org.apache.directory.api.asn1.EncoderException
HostAddress :
0x30 LL
0xA0 LL
0x02 0x01 addr-type
0xA1 LL
0x04 LL address
encode in interface org.apache.directory.api.asn1.Asn1Objectbuffer - The buffer where to put the PDU. It should have been allocated
before, with the right size.org.apache.directory.api.asn1.EncoderExceptionpublic HostAddrType getAddrType()
HostAddrType of this HostAddress.HostAddrType.public void setAddrType(HostAddrType addrType)
addrType - The address typepublic void setAddrType(int addrType)
addrType - The address typepublic java.lang.String toString()
toString in class java.lang.Object