Modifier and Type | Class and Description |
---|---|
static class |
Record.CLASS
The symbolic class of a DNS record (usually
Record.CLASS.IN for Internet). |
static class |
Record.TYPE
The resource record type.
|
Modifier and Type | Field and Description |
---|---|
Record.CLASS |
clazz
The record class (usually CLASS.IN).
|
int |
clazzValue
The value of the class field of a RR.
|
DnsName |
name
The generic name of this record.
|
D |
payloadData
The payload object of this record.
|
long |
ttl
The ttl of this record.
|
Record.TYPE |
type
The type (and payload type) of this record.
|
boolean |
unicastQuery
MDNS defines the highest bit of the class as the unicast query bit.
|
Constructor and Description |
---|
Record(DnsName name,
Record.TYPE type,
int clazzValue,
long ttl,
D payloadData) |
Record(DnsName name,
Record.TYPE type,
Record.CLASS clazz,
long ttl,
D payloadData,
boolean unicastQuery) |
Record(String name,
Record.TYPE type,
int clazzValue,
long ttl,
D payloadData) |
Record(String name,
Record.TYPE type,
Record.CLASS clazz,
long ttl,
D payloadData,
boolean unicastQuery) |
Modifier and Type | Method and Description |
---|---|
<E extends Data> |
as(Class<E> dataClass)
Return the record as record with the given
Data class. |
boolean |
equals(Object other) |
static <E extends Data> |
filter(Class<E> dataClass,
Collection<Record<? extends Data>> input) |
static <E extends Data> |
filter(Collection<Record<E>> result,
Class<E> dataClass,
Collection<Record<? extends Data>> input) |
D |
getPayload()
The payload data, usually a subclass of data (A, AAAA, CNAME, ...).
|
Question |
getQuestion()
Get the question asking for this resource record.
|
DnsMessage.Builder |
getQuestionMessage() |
long |
getTtl()
Retrieve the record ttl.
|
int |
hashCode() |
<E extends Data> |
ifPossibleAs(Class<E> dataClass)
Return the record if possible as record with the given
Data class. |
boolean |
isAnswer(Question q)
Check if this record answers a given query.
|
boolean |
isUnicastQuery()
See if this query/response was a unicast query (highest class bit set).
|
static Record<Data> |
parse(DataInputStream dis,
byte[] data)
Parse a given record based on the full message data and the current
stream position.
|
byte[] |
toByteArray() |
void |
toOutputStream(OutputStream outputStream) |
String |
toString()
Retrieve a textual representation of this resource record.
|
public final DnsName name
public final Record.TYPE type
public final Record.CLASS clazz
public final int clazzValue
public final long ttl
public final boolean unicastQuery
public Record(DnsName name, Record.TYPE type, Record.CLASS clazz, long ttl, D payloadData, boolean unicastQuery)
public Record(String name, Record.TYPE type, Record.CLASS clazz, long ttl, D payloadData, boolean unicastQuery)
public Record(String name, Record.TYPE type, int clazzValue, long ttl, D payloadData)
public Record(DnsName name, Record.TYPE type, int clazzValue, long ttl, D payloadData)
public static Record<Data> parse(DataInputStream dis, byte[] data) throws IOException
dis
- The DataInputStream positioned at the first record byte.data
- The full message data.IOException
- In case of malformed replies.public void toOutputStream(OutputStream outputStream) throws IOException
IOException
public byte[] toByteArray()
public String toString()
public boolean isAnswer(Question q)
q
- The query.public boolean isUnicastQuery()
public D getPayload()
public long getTtl()
public Question getQuestion()
null
if the record is not retrievable, i.e.
Record.TYPE.OPT
.null
.public DnsMessage.Builder getQuestionMessage()
public <E extends Data> Record<E> ifPossibleAs(Class<E> dataClass)
Data
class. If the record does not hold payload of
the given data class type, then null
will be returned.public <E extends Data> Record<E> as(Class<E> dataClass)
Data
class. If the record does not hold payload of
the given data class type, then a IllegalArgumentException
will be thrown.E
- a subtype of Data
.dataClass
- a class of the Data
type.ifPossibleAs(Class)
public static <E extends Data> void filter(Collection<Record<E>> result, Class<E> dataClass, Collection<Record<? extends Data>> input)