public final class DNSAddressRR extends Object
Holds a DNS resource record which is a DNS response that gives the IP address of a particular hostname. A resource record typically has:
Element | Description |
Name | Domain name that the resource record describes. |
Type | Type of RR. |
Class | RR Class. |
TTL | Time-To-Live for the RR. |
RDLEN | Length of the following data. |
Data | Actual data of this RR. |
Constructor and Description |
---|
DNSAddressRR(String name,
int type,
int clas,
long ttl,
DNSInputStream dnsIn)
Constructs an new DNS Address Resource Record with the specified
information.
|
Modifier and Type | Method and Description |
---|---|
byte[] |
getAddress()
Returns the address from the address record as a byte array.
|
InetAddress |
getInetAddress()
the InetAddress of the address contained for the record.
|
int |
getRRClass()
Returns the class of this RR.
|
String |
getRRName()
Returns the name of this RR.
|
long |
getRRTTL()
Returns the TTL of this RR.
|
int |
getRRType()
Returns the type of this RR.
|
boolean |
isValid()
Returns true if still valid i.e.
|
String |
toString()
Converts the object to a textual string that describes the resource
record.
|
public DNSAddressRR(String name, int type, int clas, long ttl, DNSInputStream dnsIn) throws IOException
Constructs an new DNS Address Resource Record with the specified information.
name
- name of the RRtype
- type of the RRclas
- class of the RRttl
- time for which this RR is validdnsIn
- inputstream for this RRIOException
- Thrown if an error occurs decoding data from the passed
DNSInputStream.IOException
- if any.public byte[] getAddress()
Returns the address from the address record as a byte array.
public InetAddress getInetAddress() throws UnknownHostException
the InetAddress of the address contained for the record.
UnknownHostException
- Thrown if the InetAddress object cannot be constructed.UnknownHostException
- if any.public String toString()
Converts the object to a textual string that describes the resource record.
public String getRRName()
Returns the name of this RR.
public int getRRType()
Returns the type of this RR.
public int getRRClass()
Returns the class of this RR.
public long getRRTTL()
Returns the TTL of this RR.
public boolean isValid()
Returns true if still valid i.e. TTL has not expired.
Copyright © 2021. All rights reserved.