Package org.xbill.DNS
Class RRset
java.lang.Object
org.xbill.DNS.RRset
- All Implemented Interfaces:
Serializable
,Iterable<Record>
A set of Records with the same name, type, and class. Also included are all RRSIG records signing
the data records.
- Author:
- Brian Wellington
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionRRset()
Creates an empty RRsetCreates an RRset and sets its contents to the specified record(s)Creates an RRset and sets its contents to the specified recordCreates an RRset and sets its contents to the specified record(s)Creates an RRset with the contents of an existing RRset -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a Record to this RRset.void
addRR
(RRSIGRecord r) Adds a signature to this RRset.protected boolean
void
clear()
Deletes all records (including signatures) from this RRsetvoid
Deletes a record from this RRsetvoid
Deletes a signature from this RRsetboolean
first()
Returns the first record in this RRset, either an RR or a signature.int
Returns the class of the recordsgetName()
Returns the name of the recordslong
getTTL()
Returns the ttl of the recordsint
getType()
Returns the type of the records.int
hashCode()
boolean
isEmpty()
Returnstrue
if this RRset is empty, i.e. if there are neither data nor signature records.iterator()
Returns anIterator
over the resource records.rrs()
Returns a list of all data records.rrs
(boolean cycle) Returns a list of all data records.sigs()
Returns a list of all signature records.int
sigSize()
Returns the number of signature records.int
size()
Returns the number of data records.toString()
Converts the RRset to a StringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
RRset
public RRset()Creates an empty RRset -
RRset
Creates an RRset and sets its contents to the specified record -
RRset
Creates an RRset and sets its contents to the specified record(s)- Parameters:
records
- The records to add to the set. SeeaddRR(Record)
for restrictions.
-
RRset
Creates an RRset and sets its contents to the specified record(s)- Parameters:
records
- The records to add to the set. SeeaddRR(Record)
for restrictions.- Since:
- 3.6
-
RRset
Creates an RRset with the contents of an existing RRset
-
-
Method Details
-
addRR
Adds a signature to this RRset. If the TTL of the added signature is not the same as existing records in the RRset, all records are set to the lowest TTL of either the added record or the existing records.- Throws:
IllegalArgumentException
- if the RRset already contains records and the signature to add does not match.
-
addRR
Adds a Record to this RRset. If the TTL of the added record is not the same as existing records in the RRset, all records are set to the lowest TTL of either the added record or the existing records.- Throws:
IllegalArgumentException
- if the RRset already contains records and the record to add does not match.
-
deleteRR
Deletes a signature from this RRset -
deleteRR
Deletes a record from this RRset -
clear
public void clear()Deletes all records (including signatures) from this RRset -
rrs
Returns a list of all data records.- Parameters:
cycle
- If true, cycle through the records so that each list will start with a different record.
-
rrs
Returns a list of all data records. This cycles through the records, so that each returned list will start with a different record. -
sigs
Returns a list of all signature records. -
size
public int size()Returns the number of data records. -
sigSize
public int sigSize()Returns the number of signature records.- Since:
- 3.6
-
isEmpty
public boolean isEmpty()Returnstrue
if this RRset is empty, i.e. if there are neither data nor signature records.- Since:
- 3.6
-
getName
Returns the name of the records- See Also:
-
getType
public int getType()Returns the type of the records. If this set contains only signatures, it returns the covered type.- See Also:
-
getDClass
public int getDClass()Returns the class of the records- See Also:
-
getTTL
public long getTTL()Returns the ttl of the records -
first
Returns the first record in this RRset, either an RR or a signature.- Throws:
IllegalStateException
- if the RRset is empty
-
toString
Converts the RRset to a String -
iterator
Returns anIterator
over the resource records. This is a convenience method / interface implementation and equivalent to callingrrs().iterator()
. -
equals
-
canEqual
-
hashCode
public int hashCode()
-