Package org.xbill.DNS

Class RRset

java.lang.Object
org.xbill.DNS.RRset
All Implemented Interfaces:
Serializable, Iterable<Record>

public class RRset extends Object implements 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 Details

    • RRset

      public RRset()
      Creates an empty RRset
    • RRset

      public RRset(Record record)
      Creates an RRset and sets its contents to the specified record
    • RRset

      public RRset(Record... records)
      Creates an RRset and sets its contents to the specified record(s)
      Parameters:
      records - The records to add to the set. See addRR(Record) for restrictions.
    • RRset

      public RRset(Iterable<Record> records)
      Creates an RRset and sets its contents to the specified record(s)
      Parameters:
      records - The records to add to the set. See addRR(Record) for restrictions.
      Since:
      3.6
    • RRset

      public RRset(RRset rrset)
      Creates an RRset with the contents of an existing RRset
  • Method Details

    • addRR

      public void addRR(RRSIGRecord r)
      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

      public void addRR(Record r)
      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

      public void deleteRR(RRSIGRecord r)
      Deletes a signature from this RRset
    • deleteRR

      public void deleteRR(Record r)
      Deletes a record from this RRset
    • clear

      public void clear()
      Deletes all records (including signatures) from this RRset
    • rrs

      public List<Record> rrs(boolean cycle)
      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

      public List<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

      public List<RRSIGRecord> 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()
      Returns true if this RRset is empty, i.e. if there are neither data nor signature records.
      Since:
      3.6
    • getName

      public Name 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

      public Record first()
      Returns the first record in this RRset, either an RR or a signature.
      Throws:
      IllegalStateException - if the RRset is empty
    • toString

      public String toString()
      Converts the RRset to a String
      Overrides:
      toString in class Object
    • iterator

      public Iterator<Record> iterator()
      Returns an Iterator over the resource records. This is a convenience method / interface implementation and equivalent to calling rrs().iterator().
      Specified by:
      iterator in interface Iterable<Record>
      Since:
      3.6
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • canEqual

      protected boolean canEqual(Object other)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object