Class XmlRecordSetIterator

  • All Implemented Interfaces:
    Iterator<Gedcomx>, RecordSetIterator

    public class XmlRecordSetIterator
    extends Object
    implements RecordSetIterator
    Class for iterating through the 'record' elements (GedcomX documents) in a RecordSet one at a time from a stream (e.g., a gzipped byte array) without having to inflate all the records at once. This is for a RecordSet serialized to XML. User: Randy Wilson Date: 7/31/2014 Time: 1:58 PM
    • Constructor Detail

      • XmlRecordSetIterator

        public XmlRecordSetIterator​(String filename)
                             throws IOException
        Constructor for a record iterator that takes a filename of a RecordSet file and iterates through its record elements.
        Parameters:
        filename - - Filename to read a GedcomX RecordSet file from.
        Throws:
        IOException - If there's an I/O problem.
      • XmlRecordSetIterator

        public XmlRecordSetIterator​(InputStream inputStream)
                             throws IOException
        Constructor for a record iterator that takes an InputStream of a RecordSet file and iterates through its record elements.
        Parameters:
        inputStream - - InputStream to read a GedcomX RecordSet file from.
        Throws:
        IOException - If there's an I/O problem.
      • XmlRecordSetIterator

        public XmlRecordSetIterator​(BufferedReader reader)
                             throws IOException
        Constructor for a record iterator that takes a BufferedReader of a RecordSet file and iterates through its record elements.
        Parameters:
        reader - - BufferedReader to read a GedcomX RecordSet file from.
        Throws:
        IOException - If there's an I/O problem.
    • Method Detail

      • hasNext

        public boolean hasNext()
        Tell whether the RecordIterator has another GedcomX record to return.
        Specified by:
        hasNext in interface Iterator<Gedcomx>
        Specified by:
        hasNext in interface RecordSetIterator
        Returns:
        true if there is another record to read; false otherwise.
      • getMetadata

        public Gedcomx getMetadata()
        Description copied from interface: RecordSetIterator
        Retrieve the metadata for the RecordSet.
        Specified by:
        getMetadata in interface RecordSetIterator
        Returns:
        A Gedcomx document representing the metadata (or collection information) of the RecordSet.
      • close

        public void close()
        Close the input stream and accompanying reader if they are still open. If an exception occurs trying to close things, it is caught here.
        Specified by:
        close in interface RecordSetIterator