- java.lang.Object
-
- io.netty5.handler.codec.dns.AbstractDnsRecord
-
- io.netty5.handler.codec.dns.DefaultDnsRawRecord
-
- All Implemented Interfaces:
DnsRawRecord
,DnsRecord
,Resource<DnsRawRecord>
,AutoCloseable
@UnstableApi public class DefaultDnsRawRecord extends AbstractDnsRecord implements DnsRawRecord
The defaultDnsRawRecord
implementation.
-
-
Field Summary
-
Fields inherited from interface io.netty5.handler.codec.dns.DnsRecord
CLASS_ANY, CLASS_CHAOS, CLASS_CSNET, CLASS_HESIOD, CLASS_IN, CLASS_NONE
-
-
Constructor Summary
Constructors Constructor Description DefaultDnsRawRecord(String name, DnsRecordType type, int dnsClass, long timeToLive, Buffer content)
Creates a new record.DefaultDnsRawRecord(String name, DnsRecordType type, int dnsClass, long timeToLive, Send<Buffer> content)
DefaultDnsRawRecord(String name, DnsRecordType type, long timeToLive, Buffer content)
Creates a newIN-class
record.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Close the resource, making it inaccessible.Buffer
content()
Get a reference to theBuffer
backing this raw DNS record.DnsRawRecord
copy()
Returns a copy of this record object.boolean
isAccessible()
Check if this object is accessible.DnsRawRecord
replace(Buffer content)
Send<DnsRawRecord>
send()
Send this object instance to another Thread, transferring the ownership to the recipient.String
toString()
DnsRawRecord
touch(Object hint)
Record the current access location for debugging purposes.-
Methods inherited from class io.netty5.handler.codec.dns.AbstractDnsRecord
dnsClass, equals, hashCode, name, timeToLive, type
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface io.netty5.handler.codec.dns.DnsRecord
dnsClass, name, timeToLive, type
-
-
-
-
Constructor Detail
-
DefaultDnsRawRecord
public DefaultDnsRawRecord(String name, DnsRecordType type, long timeToLive, Buffer content)
Creates a newIN-class
record.- Parameters:
name
- the domain nametype
- the type of the recordtimeToLive
- the TTL value of the record
-
DefaultDnsRawRecord
public DefaultDnsRawRecord(String name, DnsRecordType type, int dnsClass, long timeToLive, Buffer content)
Creates a new record.- Parameters:
name
- the domain nametype
- the type of the recorddnsClass
- the class of the record, usually one of the following:timeToLive
- the TTL value of the record
-
DefaultDnsRawRecord
public DefaultDnsRawRecord(String name, DnsRecordType type, int dnsClass, long timeToLive, Send<Buffer> content)
-
-
Method Detail
-
content
public Buffer content()
Description copied from interface:DnsRawRecord
Get a reference to theBuffer
backing this raw DNS record. Care must be taken with the returned buffer, as changes to the buffer offsets or its contents will reflect on the raw DNS record contents.- Specified by:
content
in interfaceDnsRawRecord
- Returns:
- The
Buffer
instance backing this raw DNS record.
-
replace
public DnsRawRecord replace(Buffer content)
-
send
public Send<DnsRawRecord> send()
Description copied from interface:Resource
Send this object instance to another Thread, transferring the ownership to the recipient.The object must be in a state where it can be sent, which includes at least being accessible.
When sent, this instance will immediately become inaccessible, as if by closing it. All attempts at accessing an object that has been sent, even if that object has not yet been received, should cause an exception to be thrown.
Calling
Resource.close()
on an object that has been sent will have no effect, so this method is safe to call within a try-with-resources statement.- Specified by:
send
in interfaceResource<DnsRawRecord>
-
close
public void close()
Description copied from interface:Resource
Close the resource, making it inaccessible.Note, this method is not thread-safe unless otherwise specified.
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceResource<DnsRawRecord>
-
isAccessible
public boolean isAccessible()
Description copied from interface:Resource
Check if this object is accessible.- Specified by:
isAccessible
in interfaceResource<DnsRawRecord>
- Returns:
true
if this object is still valid and can be accessed, otherwisefalse
if, for instance, this object has been dropped/deallocated, or been sent elsewhere.
-
touch
public DnsRawRecord touch(Object hint)
Description copied from interface:Resource
Record the current access location for debugging purposes. This information may be included if the resource throws a life-cycle related exception, or if it leaks. If this resource has already been closed, then this method has no effect.- Specified by:
touch
in interfaceDnsRawRecord
- Specified by:
touch
in interfaceResource<DnsRawRecord>
- Parameters:
hint
- An optional hint about this access and its context. May benull
.- Returns:
- This resource instance.
-
toString
public String toString()
- Overrides:
toString
in classAbstractDnsRecord
-
copy
public DnsRawRecord copy()
Description copied from interface:DnsRecord
Returns a copy of this record object. Immutable record objects may return themselves.- Specified by:
copy
in interfaceDnsRawRecord
- Specified by:
copy
in interfaceDnsRecord
-
-