Class DNSEntry
java.lang.Object
javax.jmdns.impl.DNSEntry
- Direct Known Subclasses:
DNSQuestion, DNSRecord
DNS entry with a name, type, and class. This is the base class for questions and records.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final DNSRecordClassprivate final Stringprivate final String(package private) final Map<ServiceInfo.Fields, String> private final DNSRecordTypeprivate final Stringprivate final boolean -
Constructor Summary
ConstructorsConstructorDescriptionDNSEntry(String name, DNSRecordType type, DNSRecordClass recordClass, boolean unique) Create an entry. -
Method Summary
Modifier and TypeMethodDescriptionintDoes a lexicographic comparison of the byte array representation of this record and that record.booleangetKey()Returns the key for this entry.getName()Returns the name of this entryReturns the subtype of this entrygetType()inthashCode()Overriden, to return a value which is consistent with the value returned by equals(Object).booleanabstract booleanisExpired(long now) Check if the record is expired.booleanbooleanisSameEntry(DNSEntry entry) Check if two entries have exactly the same name, type, and class.booleanisSameRecordClass(DNSEntry entry) Check that 2 entries are of the same class.booleanisSameType(DNSEntry entry) Check that 2 entries are of the same type.booleanabstract booleanisStale(long now) Check if the record is stale, i.e.booleanisUnique()booleanbooleanbooleanmatchRecordClass(DNSRecordClass recordClass) Check if the requested record class match the current record classbooleanmatchRecordType(DNSRecordType recordType) Check if the requested record tyep match the current record typebooleansameSubtype(DNSEntry other) Check if two entries have the same subtype.protected byte[]Creates a byte array representation of this record.protected voidtoByteArray(DataOutputStream dout) toString()protected void
-
Field Details
-
_key
-
_name
-
_type
-
_recordType
-
_dnsClass
-
_unique
private final boolean _unique -
_qualifiedNameMap
-
-
Constructor Details
-
DNSEntry
DNSEntry(String name, DNSRecordType type, DNSRecordClass recordClass, boolean unique) Create an entry.
-
-
Method Details
-
equals
-
isSameEntry
Check if two entries have exactly the same name, type, and class.- Parameters:
entry-- Returns:
trueif the two entries have are for the same record,falseotherwise
-
sameSubtype
Check if two entries have the same subtype.- Parameters:
other-- Returns:
trueif the two entries have are for the same subtype,falseotherwise
-
matchRecordClass
Check if the requested record class match the current record class- Parameters:
recordClass-- Returns:
trueif the two entries have compatible class,falseotherwise
-
matchRecordType
Check if the requested record tyep match the current record type- Parameters:
recordType-- Returns:
trueif the two entries have compatible type,falseotherwise
-
getSubtype
-
getName
-
getType
- Returns:
- the type
-
getKey
Returns the key for this entry. The key is the lower case name.- Returns:
- key for this entry
-
getRecordType
- Returns:
- record type
-
getRecordClass
- Returns:
- record class
-
isUnique
public boolean isUnique()- Returns:
- true if unique
-
getQualifiedNameMap
-
isServicesDiscoveryMetaQuery
public boolean isServicesDiscoveryMetaQuery() -
isDomainDiscoveryQuery
public boolean isDomainDiscoveryQuery() -
isReverseLookup
public boolean isReverseLookup() -
isV4ReverseLookup
public boolean isV4ReverseLookup() -
isV6ReverseLookup
public boolean isV6ReverseLookup() -
isStale
public abstract boolean isStale(long now) Check if the record is stale, i.e. it has outlived more than half of its TTL.- Parameters:
now- update date- Returns:
trueis the record is stale,falseotherwise.
-
isExpired
public abstract boolean isExpired(long now) Check if the record is expired.- Parameters:
now- update date- Returns:
trueis the record is expired,falseotherwise.
-
isSameRecordClass
Check that 2 entries are of the same class.- Parameters:
entry-- Returns:
trueis the two class are the same,falseotherwise.
-
isSameType
Check that 2 entries are of the same type.- Parameters:
entry-- Returns:
trueis the two type are the same,falseotherwise.
-
toByteArray
- Parameters:
dout-- Throws:
IOException
-
toByteArray
protected byte[] toByteArray()Creates a byte array representation of this record. This is needed for tie-break tests according to draft-cheshire-dnsext-multicastdns-04.txt chapter 9.2.- Returns:
- byte array representation
-
compareTo
Does a lexicographic comparison of the byte array representation of this record and that record. This is needed for tie-break tests according to draft-cheshire-dnsext-multicastdns-04.txt chapter 9.2.- Parameters:
that-- Returns:
- a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
-
hashCode
-
toString
-
toString
- Parameters:
sb-
-