org.xbill.DNS
Class Master

java.lang.Object
  extended by org.xbill.DNS.Master

public class Master
extends Object

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 Summary
Master(InputStream in)
          Initializes the master file reader.
Master(InputStream in, Name origin)
          Initializes the master file reader.
Master(InputStream in, Name origin, long ttl)
          Initializes the master file reader.
Master(String filename)
          Initializes the master file reader and opens the specified master file.
Master(String filename, Name origin)
          Initializes the master file reader and opens the specified master file.
Master(String filename, Name origin, long ttl)
          Initializes the master file reader and opens the specified master file.
 
Method Summary
 Record _nextRecord()
          Returns the next record in the master file.
 void expandGenerate(boolean wantExpand)
          Specifies whether $GENERATE statements should be expanded.
protected  void finalize()
           
 Iterator generators()
          Returns an iterator over the generators specified in the master file; that is, the parsed contents of $GENERATE statements.
 Record nextRecord()
          Returns the next record in the master file.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

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 Detail

_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.

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.

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 generators()
Returns an iterator over the generators specified in the master file; that is, the parsed contents of $GENERATE statements.

See Also:
Generator

finalize

protected void finalize()
Overrides:
finalize in class Object