@UnstableApi public abstract class AbstractDnsMessage extends AbstractReferenceCounted implements DnsMessage
DnsMessage.| Modifier and Type | Field and Description |
|---|---|
private java.lang.Object |
additionals |
private java.lang.Object |
answers |
private java.lang.Object |
authorities |
private short |
id |
private ResourceLeakTracker<DnsMessage> |
leak |
private static ResourceLeakDetector<DnsMessage> |
leakDetector |
private DnsOpCode |
opCode |
private java.lang.Object |
questions |
private boolean |
recursionDesired |
private static int |
SECTION_COUNT |
private static int |
SECTION_QUESTION |
private byte |
z |
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractDnsMessage(int id)
Creates a new instance with the specified
id and DnsOpCode.QUERY opCode. |
protected |
AbstractDnsMessage(int id,
DnsOpCode opCode)
Creates a new instance with the specified
id and opCode. |
| Modifier and Type | Method and Description |
|---|---|
DnsMessage |
addRecord(DnsSection section,
DnsRecord record)
Adds the specified
record at the end of the specified section of this DNS message. |
DnsMessage |
addRecord(DnsSection section,
int index,
DnsRecord record)
Adds the specified
record at the specified index of the specified section
of this DNS message. |
private void |
addRecord(int section,
DnsRecord record) |
private void |
addRecord(int section,
int index,
DnsRecord record) |
private static <T extends DnsRecord> |
castRecord(java.lang.Object record) |
private static DnsRecord |
checkQuestion(int section,
DnsRecord record) |
DnsMessage |
clear()
Removes all the records in this DNS message.
|
DnsMessage |
clear(DnsSection section)
Removes all the records in the specified
section of this DNS message. |
private void |
clear(int section) |
int |
count()
Returns the number of records in this DNS message.
|
int |
count(DnsSection section)
Returns the number of records in the specified
section of this DNS message. |
private int |
count(int section) |
protected void |
deallocate()
Called once
AbstractReferenceCounted.refCnt() is equals 0. |
boolean |
equals(java.lang.Object obj) |
int |
hashCode() |
int |
id()
Returns the
ID of this DNS message. |
boolean |
isRecursionDesired()
Returns the
RD (recursion desired} field of this DNS message. |
private static java.util.ArrayList<DnsRecord> |
newRecordList() |
DnsOpCode |
opCode()
Returns the
opCode of this DNS message. |
<T extends DnsRecord> |
recordAt(DnsSection section)
Returns the first record in the specified
section of this DNS message. |
<T extends DnsRecord> |
recordAt(DnsSection section,
int index)
Returns the record at the specified
index of the specified section of this DNS message. |
private <T extends DnsRecord> |
recordAt(int section) |
private <T extends DnsRecord> |
recordAt(int section,
int index) |
<T extends DnsRecord> |
removeRecord(DnsSection section,
int index)
Removes the record at the specified
index of the specified section from this DNS message. |
private <T extends DnsRecord> |
removeRecord(int section,
int index) |
DnsMessage |
retain()
Increases the reference count by
1. |
DnsMessage |
retain(int increment)
Increases the reference count by the specified
increment. |
private java.lang.Object |
sectionAt(int section) |
private static int |
sectionOrdinal(DnsSection section) |
DnsMessage |
setId(int id)
Sets the
ID of this DNS message. |
DnsMessage |
setOpCode(DnsOpCode opCode)
Sets the
opCode of this DNS message. |
DnsMessage |
setRecord(DnsSection section,
DnsRecord record)
Sets the specified
section of this DNS message to the specified record,
making it a single-record section. |
<T extends DnsRecord> |
setRecord(DnsSection section,
int index,
DnsRecord record)
Sets the specified
record at the specified index of the specified section
of this DNS message. |
private void |
setRecord(int section,
DnsRecord record) |
private <T extends DnsRecord> |
setRecord(int section,
int index,
DnsRecord record) |
DnsMessage |
setRecursionDesired(boolean recursionDesired)
Sets the
RD (recursion desired} field of this DNS message. |
private void |
setSection(int section,
java.lang.Object value) |
DnsMessage |
setZ(int z)
Sets the
Z (reserved for future use) field of this DNS message. |
DnsMessage |
touch()
Records the current access location of this object for debugging purposes.
|
DnsMessage |
touch(java.lang.Object hint)
Records the current access location of this object with an additional arbitrary information for debugging
purposes.
|
int |
z()
Returns the
Z (reserved for future use) field of this DNS message. |
refCnt, release, release, setRefCntclone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitrefCnt, release, releaseprivate static final ResourceLeakDetector<DnsMessage> leakDetector
private static final int SECTION_QUESTION
private static final int SECTION_COUNT
private final ResourceLeakTracker<DnsMessage> leak
private short id
private DnsOpCode opCode
private boolean recursionDesired
private byte z
private java.lang.Object questions
private java.lang.Object answers
private java.lang.Object authorities
private java.lang.Object additionals
protected AbstractDnsMessage(int id)
id and DnsOpCode.QUERY opCode.protected AbstractDnsMessage(int id,
DnsOpCode opCode)
id and opCode.public int id()
DnsMessageID of this DNS message.id in interface DnsMessagepublic DnsMessage setId(int id)
DnsMessageID of this DNS message.setId in interface DnsMessagepublic DnsOpCode opCode()
DnsMessageopCode of this DNS message.opCode in interface DnsMessagepublic DnsMessage setOpCode(DnsOpCode opCode)
DnsMessageopCode of this DNS message.setOpCode in interface DnsMessagepublic boolean isRecursionDesired()
DnsMessageRD (recursion desired} field of this DNS message.isRecursionDesired in interface DnsMessagepublic DnsMessage setRecursionDesired(boolean recursionDesired)
DnsMessageRD (recursion desired} field of this DNS message.setRecursionDesired in interface DnsMessagepublic int z()
DnsMessageZ (reserved for future use) field of this DNS message.z in interface DnsMessagepublic DnsMessage setZ(int z)
DnsMessageZ (reserved for future use) field of this DNS message.setZ in interface DnsMessagepublic int count(DnsSection section)
DnsMessagesection of this DNS message.count in interface DnsMessageprivate int count(int section)
public int count()
DnsMessagecount in interface DnsMessagepublic <T extends DnsRecord> T recordAt(DnsSection section)
DnsMessagesection of this DNS message.
When the specified section is DnsSection.QUESTION, the type of the returned record is
always DnsQuestion.recordAt in interface DnsMessagenull if this message doesn't have any records in the specified sectionprivate <T extends DnsRecord> T recordAt(int section)
public <T extends DnsRecord> T recordAt(DnsSection section, int index)
DnsMessageindex of the specified section of this DNS message.
When the specified section is DnsSection.QUESTION, the type of the returned record is
always DnsQuestion.recordAt in interface DnsMessageprivate <T extends DnsRecord> T recordAt(int section, int index)
public DnsMessage setRecord(DnsSection section, DnsRecord record)
DnsMessagesection of this DNS message to the specified record,
making it a single-record section. When the specified section is DnsSection.QUESTION,
the specified record must be a DnsQuestion.setRecord in interface DnsMessageprivate void setRecord(int section,
DnsRecord record)
public <T extends DnsRecord> T setRecord(DnsSection section, int index, DnsRecord record)
DnsMessagerecord at the specified index of the specified section
of this DNS message. When the specified section is DnsSection.QUESTION,
the specified record must be a DnsQuestion.setRecord in interface DnsMessagepublic DnsMessage addRecord(DnsSection section, DnsRecord record)
DnsMessagerecord at the end of the specified section of this DNS message.
When the specified section is DnsSection.QUESTION, the specified record
must be a DnsQuestion.addRecord in interface DnsMessageprivate void addRecord(int section,
DnsRecord record)
public DnsMessage addRecord(DnsSection section, int index, DnsRecord record)
DnsMessagerecord at the specified index of the specified section
of this DNS message. When the specified section is DnsSection.QUESTION, the specified
record must be a DnsQuestion.addRecord in interface DnsMessageprivate void addRecord(int section,
int index,
DnsRecord record)
public <T extends DnsRecord> T removeRecord(DnsSection section, int index)
DnsMessageindex of the specified section from this DNS message.
When the specified section is DnsSection.QUESTION, the type of the returned record is
always DnsQuestion.removeRecord in interface DnsMessageprivate <T extends DnsRecord> T removeRecord(int section, int index)
public DnsMessage clear(DnsSection section)
DnsMessagesection of this DNS message.clear in interface DnsMessagepublic DnsMessage clear()
DnsMessageclear in interface DnsMessageprivate void clear(int section)
public DnsMessage touch()
ReferenceCountedResourceLeakDetector. This method is a shortcut to touch(null).touch in interface DnsMessagetouch in interface ReferenceCountedtouch in class AbstractReferenceCountedpublic DnsMessage touch(java.lang.Object hint)
ReferenceCountedResourceLeakDetector.touch in interface DnsMessagetouch in interface ReferenceCountedpublic DnsMessage retain()
ReferenceCounted1.retain in interface DnsMessageretain in interface ReferenceCountedretain in class AbstractReferenceCountedpublic DnsMessage retain(int increment)
ReferenceCountedincrement.retain in interface DnsMessageretain in interface ReferenceCountedretain in class AbstractReferenceCountedprotected void deallocate()
AbstractReferenceCountedAbstractReferenceCounted.refCnt() is equals 0.deallocate in class AbstractReferenceCountedpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectprivate java.lang.Object sectionAt(int section)
private void setSection(int section,
java.lang.Object value)
private static int sectionOrdinal(DnsSection section)
private static <T extends DnsRecord> T castRecord(java.lang.Object record)
private static java.util.ArrayList<DnsRecord> newRecordList()