Package org.xbill.DNS

Class Master

java.lang.Object
org.xbill.DNS.Master
All Implemented Interfaces:
AutoCloseable

public class Master extends Object implements AutoCloseable
A DNS master file parser. This incrementally parses the file, returning one record at a time. When directives are seen, they are added to the state and used when parsing future records.
Author:
Brian Wellington
  • Constructor Details

    • Master

      public Master(String filename, Name origin, long ttl) throws IOException
      Initializes the master file reader and opens the specified master file.
      Parameters:
      filename - The master file.
      origin - The initial origin to append to relative names.
      ttl - The initial default TTL.
      Throws:
      IOException - The master file could not be opened.
    • Master

      public Master(String filename, Name origin) throws IOException
      Initializes the master file reader and opens the specified master file.
      Parameters:
      filename - The master file.
      origin - The initial origin to append to relative names.
      Throws:
      IOException - The master file could not be opened.
    • Master

      public Master(String filename) throws IOException
      Initializes the master file reader and opens the specified master file.
      Parameters:
      filename - The master file.
      Throws:
      IOException - The master file could not be opened.
    • Master

      public Master(InputStream in, Name origin, long ttl)
      Initializes the master file reader.
      Parameters:
      in - The input stream containing a master file.
      origin - The initial origin to append to relative names.
      ttl - The initial default TTL.
    • Master

      public Master(InputStream in, Name origin)
      Initializes the master file reader.
      Parameters:
      in - The input stream containing a master file.
      origin - The initial origin to append to relative names.
    • Master

      public Master(InputStream in)
      Initializes the master file reader.
      Parameters:
      in - The input stream containing a master file.
  • Method Details

    • nextRecord

      public Record nextRecord() throws IOException
      Returns the next record in the master file. This will process any directives before the next record.
      Returns:
      The next record.
      Throws:
      IOException - The master file could not be read, or was syntactically invalid.
    • disableIncludes

      public void disableIncludes()
      Disable processing of $INCLUDE directives. When disabled, $INCLUDE statements will not be processed. Depending on the contents of the file that would have been included, this may cause the zone to be invalid. (e.g. if there is no SOA or NS at the apex)
    • disableIncludes

      public void disableIncludes(boolean strict)
      Disable processing of $INCLUDE directives. When disabled, $INCUDE statements will not be processed. Depending on the contents of the file that would have been included, this may cause the zone to be invalid. (e.g. if there's no SOA or NS at the apex)
      Parameters:
      strict - If true, an exception will be thrown if $INCLUDE is encountered.
    • expandGenerate

      public void expandGenerate(boolean wantExpand)
      Specifies whether $GENERATE statements should be expanded. Whether expanded or not, the specifications for generated records are available by calling generators. This must be called before a $GENERATE statement is seen during iteration to have an effect.
    • generators

      public Iterator<Generator> generators()
      Returns an iterator over the generators specified in the master file; that is, the parsed contents of $GENERATE statements.
      See Also:
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable