Package javax.jmdns.impl
Class DNSEntry
- java.lang.Object
-
- javax.jmdns.impl.DNSEntry
-
- Direct Known Subclasses:
DNSQuestion
,DNSRecord
public abstract class DNSEntry extends Object
DNS entry with a name, type, and class. This is the base class for questions and records.- Author:
- Arthur van Hoff, Pierre Frisch, Rick Blair
-
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description int
compareTo(DNSEntry that)
Does a lexicographic comparison of the byte array representation of this record and that record.boolean
equals(Object obj)
String
getKey()
Returns the key for this entry.String
getName()
Returns the name of this entryMap<ServiceInfo.Fields,String>
getQualifiedNameMap()
DNSRecordClass
getRecordClass()
DNSRecordType
getRecordType()
String
getSubtype()
Returns the subtype of this entryString
getType()
int
hashCode()
Overriden, to return a value which is consistent with the value returned by equals(Object).boolean
isDomainDiscoveryQuery()
abstract boolean
isExpired(long now)
Check if the record is expired.boolean
isReverseLookup()
boolean
isSameEntry(DNSEntry entry)
Check if two entries have exactly the same name, type, and class.boolean
isSameRecordClass(DNSEntry entry)
Check that 2 entries are of the same class.boolean
isSameType(DNSEntry entry)
Check that 2 entries are of the same type.boolean
isServicesDiscoveryMetaQuery()
abstract boolean
isStale(long now)
Check if the record is stale, i.e.boolean
isUnique()
boolean
isV4ReverseLookup()
boolean
isV6ReverseLookup()
boolean
matchRecordClass(DNSRecordClass recordClass)
Check if the requested record class match the current record classboolean
matchRecordType(DNSRecordType recordType)
Check if the requested record tyep match the current record typeboolean
sameSubtype(DNSEntry other)
Check if two entries have the same subtype.protected byte[]
toByteArray()
Creates a byte array representation of this record.protected void
toByteArray(DataOutputStream dout)
String
toString()
protected void
toString(StringBuilder sb)
-
-
-
Method Detail
-
isSameEntry
public boolean isSameEntry(DNSEntry entry)
Check if two entries have exactly the same name, type, and class.- Parameters:
entry
-- Returns:
true
if the two entries have are for the same record,false
otherwise
-
sameSubtype
public boolean sameSubtype(DNSEntry other)
Check if two entries have the same subtype.- Parameters:
other
-- Returns:
true
if the two entries have are for the same subtype,false
otherwise
-
matchRecordClass
public boolean matchRecordClass(DNSRecordClass recordClass)
Check if the requested record class match the current record class- Parameters:
recordClass
-- Returns:
true
if the two entries have compatible class,false
otherwise
-
matchRecordType
public boolean matchRecordType(DNSRecordType recordType)
Check if the requested record tyep match the current record type- Parameters:
recordType
-- Returns:
true
if the two entries have compatible type,false
otherwise
-
getSubtype
public String getSubtype()
Returns the subtype of this entry- Returns:
- subtype of this entry
-
getName
public String getName()
Returns the name of this entry- Returns:
- name of this entry
-
getType
public String getType()
- Returns:
- the type
-
getKey
public String getKey()
Returns the key for this entry. The key is the lower case name.- Returns:
- key for this entry
-
getRecordType
public DNSRecordType getRecordType()
- Returns:
- record type
-
getRecordClass
public DNSRecordClass getRecordClass()
- Returns:
- record class
-
isUnique
public boolean isUnique()
- Returns:
- true if unique
-
getQualifiedNameMap
public Map<ServiceInfo.Fields,String> 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:
true
is the record is stale,false
otherwise.
-
isExpired
public abstract boolean isExpired(long now)
Check if the record is expired.- Parameters:
now
- update date- Returns:
true
is the record is expired,false
otherwise.
-
isSameRecordClass
public boolean isSameRecordClass(DNSEntry entry)
Check that 2 entries are of the same class.- Parameters:
entry
-- Returns:
true
is the two class are the same,false
otherwise.
-
isSameType
public boolean isSameType(DNSEntry entry)
Check that 2 entries are of the same type.- Parameters:
entry
-- Returns:
true
is the two type are the same,false
otherwise.
-
toByteArray
protected void toByteArray(DataOutputStream dout) throws IOException
- 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
public int compareTo(DNSEntry that)
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
public int hashCode()
Overriden, to return a value which is consistent with the value returned by equals(Object).
-
toString
protected void toString(StringBuilder sb)
- Parameters:
sb
-
-
-