Interface DnsMessage
- All Superinterfaces:
ReferenceCounted
- All Known Subinterfaces:
DnsQuery, DnsResponse
- All Known Implementing Classes:
AbstractDnsMessage, DatagramDnsQuery, DatagramDnsResponse, DefaultDnsQuery, DefaultDnsResponse
The superclass which contains core information concerning a
DnsQuery and a DnsResponse.-
Method Summary
Modifier and TypeMethodDescriptionaddRecord(DnsSection section, int index, DnsRecord record) Adds the specifiedrecordat the specifiedindexof the specifiedsectionof this DNS message.addRecord(DnsSection section, DnsRecord record) Adds the specifiedrecordat the end of the specifiedsectionof this DNS message.clear()Removes all the records in this DNS message.clear(DnsSection section) Removes all the records in the specifiedsectionof this DNS message.intcount()Returns the number of records in this DNS message.intcount(DnsSection section) Returns the number of records in the specifiedsectionof this DNS message.intid()Returns theIDof this DNS message.booleanReturns theRD(recursion desired} field of this DNS message.opCode()Returns theopCodeof this DNS message.<T extends DnsRecord>
TrecordAt(DnsSection section) Returns the first record in the specifiedsectionof this DNS message.<T extends DnsRecord>
TrecordAt(DnsSection section, int index) Returns the record at the specifiedindexof the specifiedsectionof this DNS message.<T extends DnsRecord>
TremoveRecord(DnsSection section, int index) Removes the record at the specifiedindexof the specifiedsectionfrom this DNS message.retain()Increases the reference count by1.retain(int increment) Increases the reference count by the specifiedincrement.setId(int id) Sets theIDof this DNS message.Sets theopCodeof this DNS message.<T extends DnsRecord>
TsetRecord(DnsSection section, int index, DnsRecord record) Sets the specifiedrecordat the specifiedindexof the specifiedsectionof this DNS message.setRecord(DnsSection section, DnsRecord record) Sets the specifiedsectionof this DNS message to the specifiedrecord, making it a single-record section.setRecursionDesired(boolean recursionDesired) Sets theRD(recursion desired} field of this DNS message.setZ(int z) Sets theZ(reserved for future use) field of this DNS message.touch()Records the current access location of this object for debugging purposes.Records the current access location of this object with an additional arbitrary information for debugging purposes.intz()Returns theZ(reserved for future use) field of this DNS message.Methods inherited from interface ReferenceCounted
refCnt, release, release
-
Method Details
-
id
int id()Returns theIDof this DNS message. -
setId
Sets theIDof this DNS message. -
opCode
DnsOpCode opCode()Returns theopCodeof this DNS message. -
setOpCode
Sets theopCodeof this DNS message. -
isRecursionDesired
boolean isRecursionDesired()Returns theRD(recursion desired} field of this DNS message. -
setRecursionDesired
Sets theRD(recursion desired} field of this DNS message. -
z
int z()Returns theZ(reserved for future use) field of this DNS message. -
setZ
Sets theZ(reserved for future use) field of this DNS message. -
count
Returns the number of records in the specifiedsectionof this DNS message. -
count
int count()Returns the number of records in this DNS message. -
recordAt
Returns the first record in the specifiedsectionof this DNS message. When the specifiedsectionisDnsSection.QUESTION, the type of the returned record is alwaysDnsQuestion.- Returns:
nullif this message doesn't have any records in the specifiedsection
-
recordAt
Returns the record at the specifiedindexof the specifiedsectionof this DNS message. When the specifiedsectionisDnsSection.QUESTION, the type of the returned record is alwaysDnsQuestion.- Throws:
IndexOutOfBoundsException- if the specifiedindexis out of bounds
-
setRecord
Sets the specifiedsectionof this DNS message to the specifiedrecord, making it a single-record section. When the specifiedsectionisDnsSection.QUESTION, the specifiedrecordmust be aDnsQuestion. -
setRecord
Sets the specifiedrecordat the specifiedindexof the specifiedsectionof this DNS message. When the specifiedsectionisDnsSection.QUESTION, the specifiedrecordmust be aDnsQuestion.- Returns:
- the old record
- Throws:
IndexOutOfBoundsException- if the specifiedindexis out of bounds
-
addRecord
Adds the specifiedrecordat the end of the specifiedsectionof this DNS message. When the specifiedsectionisDnsSection.QUESTION, the specifiedrecordmust be aDnsQuestion. -
addRecord
Adds the specifiedrecordat the specifiedindexof the specifiedsectionof this DNS message. When the specifiedsectionisDnsSection.QUESTION, the specifiedrecordmust be aDnsQuestion.- Throws:
IndexOutOfBoundsException- if the specifiedindexis out of bounds
-
removeRecord
Removes the record at the specifiedindexof the specifiedsectionfrom this DNS message. When the specifiedsectionisDnsSection.QUESTION, the type of the returned record is alwaysDnsQuestion.- Returns:
- the removed record
-
clear
Removes all the records in the specifiedsectionof this DNS message. -
clear
DnsMessage clear()Removes all the records in this DNS message. -
touch
DnsMessage touch()Description copied from interface:ReferenceCountedRecords the current access location of this object for debugging purposes. If this object is determined to be leaked, the information recorded by this operation will be provided to you viaResourceLeakDetector. This method is a shortcut totouch(null).- Specified by:
touchin interfaceReferenceCounted
-
touch
Description copied from interface:ReferenceCountedRecords the current access location of this object with an additional arbitrary information for debugging purposes. If this object is determined to be leaked, the information recorded by this operation will be provided to you viaResourceLeakDetector.- Specified by:
touchin interfaceReferenceCounted
-
retain
DnsMessage retain()Description copied from interface:ReferenceCountedIncreases the reference count by1.- Specified by:
retainin interfaceReferenceCounted
-
retain
Description copied from interface:ReferenceCountedIncreases the reference count by the specifiedincrement.- Specified by:
retainin interfaceReferenceCounted
-