Class AbstractDnsMessage
java.lang.Object
io.netty.util.AbstractReferenceCounted
io.netty.handler.codec.dns.AbstractDnsMessage
- All Implemented Interfaces:
DnsMessage, ReferenceCounted
- Direct Known Subclasses:
DefaultDnsQuery, DefaultDnsResponse
A skeletal implementation of
DnsMessage.-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractDnsMessage(int id) Creates a new instance with the specifiedidandDnsOpCode.QUERYopCode.protectedAbstractDnsMessage(int id, DnsOpCode opCode) Creates a new instance with the specifiedidandopCode. -
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.protected voidCalled onceAbstractReferenceCounted.refCnt()is equals 0.booleaninthashCode()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 class AbstractReferenceCounted
refCnt, release, release, setRefCntMethods inherited from class Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ReferenceCounted
refCnt, release, release
-
Constructor Details
-
AbstractDnsMessage
protected AbstractDnsMessage(int id) Creates a new instance with the specifiedidandDnsOpCode.QUERYopCode. -
AbstractDnsMessage
Creates a new instance with the specifiedidandopCode.
-
-
Method Details
-
id
public int id()Description copied from interface:DnsMessageReturns theIDof this DNS message.- Specified by:
idin interfaceDnsMessage
-
setId
Description copied from interface:DnsMessageSets theIDof this DNS message.- Specified by:
setIdin interfaceDnsMessage
-
opCode
Description copied from interface:DnsMessageReturns theopCodeof this DNS message.- Specified by:
opCodein interfaceDnsMessage
-
setOpCode
Description copied from interface:DnsMessageSets theopCodeof this DNS message.- Specified by:
setOpCodein interfaceDnsMessage
-
isRecursionDesired
public boolean isRecursionDesired()Description copied from interface:DnsMessageReturns theRD(recursion desired} field of this DNS message.- Specified by:
isRecursionDesiredin interfaceDnsMessage
-
setRecursionDesired
Description copied from interface:DnsMessageSets theRD(recursion desired} field of this DNS message.- Specified by:
setRecursionDesiredin interfaceDnsMessage
-
z
public int z()Description copied from interface:DnsMessageReturns theZ(reserved for future use) field of this DNS message.- Specified by:
zin interfaceDnsMessage
-
setZ
Description copied from interface:DnsMessageSets theZ(reserved for future use) field of this DNS message.- Specified by:
setZin interfaceDnsMessage
-
count
Description copied from interface:DnsMessageReturns the number of records in the specifiedsectionof this DNS message.- Specified by:
countin interfaceDnsMessage
-
count
public int count()Description copied from interface:DnsMessageReturns the number of records in this DNS message.- Specified by:
countin interfaceDnsMessage
-
recordAt
Description copied from interface:DnsMessageReturns the first record in the specifiedsectionof this DNS message. When the specifiedsectionisDnsSection.QUESTION, the type of the returned record is alwaysDnsQuestion.- Specified by:
recordAtin interfaceDnsMessage- Returns:
nullif this message doesn't have any records in the specifiedsection
-
recordAt
Description copied from interface:DnsMessageReturns the record at the specifiedindexof the specifiedsectionof this DNS message. When the specifiedsectionisDnsSection.QUESTION, the type of the returned record is alwaysDnsQuestion.- Specified by:
recordAtin interfaceDnsMessage
-
setRecord
Description copied from interface:DnsMessageSets the specifiedsectionof this DNS message to the specifiedrecord, making it a single-record section. When the specifiedsectionisDnsSection.QUESTION, the specifiedrecordmust be aDnsQuestion.- Specified by:
setRecordin interfaceDnsMessage
-
setRecord
Description copied from interface:DnsMessageSets the specifiedrecordat the specifiedindexof the specifiedsectionof this DNS message. When the specifiedsectionisDnsSection.QUESTION, the specifiedrecordmust be aDnsQuestion.- Specified by:
setRecordin interfaceDnsMessage- Returns:
- the old record
-
addRecord
Description copied from interface:DnsMessageAdds the specifiedrecordat the end of the specifiedsectionof this DNS message. When the specifiedsectionisDnsSection.QUESTION, the specifiedrecordmust be aDnsQuestion.- Specified by:
addRecordin interfaceDnsMessage
-
addRecord
Description copied from interface:DnsMessageAdds the specifiedrecordat the specifiedindexof the specifiedsectionof this DNS message. When the specifiedsectionisDnsSection.QUESTION, the specifiedrecordmust be aDnsQuestion.- Specified by:
addRecordin interfaceDnsMessage
-
removeRecord
Description copied from interface:DnsMessageRemoves the record at the specifiedindexof the specifiedsectionfrom this DNS message. When the specifiedsectionisDnsSection.QUESTION, the type of the returned record is alwaysDnsQuestion.- Specified by:
removeRecordin interfaceDnsMessage- Returns:
- the removed record
-
clear
Description copied from interface:DnsMessageRemoves all the records in the specifiedsectionof this DNS message.- Specified by:
clearin interfaceDnsMessage
-
clear
Description copied from interface:DnsMessageRemoves all the records in this DNS message.- Specified by:
clearin interfaceDnsMessage
-
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 interfaceDnsMessage- Specified by:
touchin interfaceReferenceCounted- Overrides:
touchin classAbstractReferenceCounted
-
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 interfaceDnsMessage- Specified by:
touchin interfaceReferenceCounted
-
retain
Description copied from interface:ReferenceCountedIncreases the reference count by1.- Specified by:
retainin interfaceDnsMessage- Specified by:
retainin interfaceReferenceCounted- Overrides:
retainin classAbstractReferenceCounted
-
retain
Description copied from interface:ReferenceCountedIncreases the reference count by the specifiedincrement.- Specified by:
retainin interfaceDnsMessage- Specified by:
retainin interfaceReferenceCounted- Overrides:
retainin classAbstractReferenceCounted
-
deallocate
protected void deallocate()Description copied from class:AbstractReferenceCountedCalled onceAbstractReferenceCounted.refCnt()is equals 0.- Specified by:
deallocatein classAbstractReferenceCounted
-
equals
-
hashCode
-