java.lang.Object
org.minidns.record.Data
org.minidns.record.InternetAddressRR<IA>
- Type Parameters:
IA- type of InetAddress stored in this record
Abstract base class for DNS resource records representing internet addresses.
Extended by A and AAAA records to provide common functionality for IP address storage and retrieval.
Extended by A and AAAA records to provide common functionality for IP address storage and retrieval.
Field Summary
FieldsModifier and TypeFieldDescriptionprivate IACache for theInetAddressthis record presents.protected final byte[]Target IP.Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedInternetAddressRR(byte[] ip) Holds the raw address bytes of an address record.protectedInternetAddressRR(IA inetAddress) Holds the raw address bytes and caches the resolved form.Method Summary
Modifier and TypeMethodDescriptionstatic InternetAddressRR<? extends InetAddress> from(InetAddress inetAddress) Create an InternetAddressRR from an InetAddress.final IAGet the InetAddress for this record.final byte[]getIp()Allocates a new byte buffer and fills the buffer with the bytes representing the IP address of this resource record.final voidWrites the raw address bytes to the stream.Methods inherited from class Data
equals, getType, hashCode, length, toByteArray, toOutputStream, toOutputStreamModifier and TypeMethodDescriptionfinal booleanabstract Record.TYPEgetType()The payload type.final inthashCode()final intlength()Serialize this record, if that has not been done already, and report the resulting wire size.final byte[]Serialize this record, if that has not been done already, and return a copy of the result so callers cannot mutate the cached bytes.final voidWrite the binary representation of this payload to the givenDataOutputStream.final voidtoOutputStream(OutputStream outputStream) Write the binary representation to the given OutputStream.
Field Details
ip
protected final byte[] ipTarget IP.inetAddress
Cache for theInetAddressthis record presents.
Constructor Details
InternetAddressRR
protected InternetAddressRR(byte[] ip) Holds the raw address bytes of an address record.- Parameters:
ip- raw address bytes, in the record's A/AAAA family order
InternetAddressRR
Holds the raw address bytes and caches the resolved form.- Parameters:
inetAddress- resolved address whose cached form this record returns
Method Details
serialize
Writes the raw address bytes to the stream.- Specified by:
serializein classData- Parameters:
dos- the output stream to serialize to.- Throws:
IOException- if an I/O error occurs.
getIp
public final byte[] getIp()Allocates a new byte buffer and fills the buffer with the bytes representing the IP address of this resource record.- Returns:
- a new byte buffer containing the bytes of the IP.
getInetAddress
Get the InetAddress for this record.- Returns:
- the InetAddress, computed lazily and cached
from
Create an InternetAddressRR from an InetAddress.- Parameters:
inetAddress- the InetAddress to convert- Returns:
- an A or AAAA record as appropriate