+ /**
+ * Attempt to read from the position where some other parsing process left
+ * off.
+ *
+ * @param source
+ * @throws IOException
+ */
+ public AlignFile(FileParse source, boolean doXferSettings)
+ throws IOException
+ {
+ this(true, source, true, doXferSettings);
+ }
+
+ public AlignFile(FileParse source) throws IOException
+ {
+ this(true, source);
+ }
+
+ /**
+ * Construct a new parser to read from the position where some other parsing
+ * process left
+ *
+ * @param parseImmediately
+ * if false, need to call 'doParse()' to begin parsing data
+ * @param source
+ */
+ public AlignFile(boolean parseImmediately, FileParse source)
+ throws IOException
+ {
+ this(parseImmediately, source, true);
+ }
+
+ public AlignFile(boolean parseImmediately, FileParse source,
+ boolean closeData) throws IOException
+ {
+ this(parseImmediately, source, closeData, true);
+ }
+
+ public AlignFile(boolean parseImmediately, FileParse source,
+ boolean closeData, boolean doXferSettings) throws IOException
+ {
+ super(source);
+ initData();
+
+ // stash flag in case parse needs to know if it has to autoconfigure or was
+ // configured after construction
+ this.parseImmediately = parseImmediately;
+ this.doXferSettings = doXferSettings;
+
+ if (parseImmediately)
+ {
+ doParse(closeData);
+ }
+ }
+
+ /**
+ * called if parsing was delayed till after parser was constructed
+ *
+ * @throws IOException
+ */
+ public void doParse() throws IOException
+ {
+ doParse(true);
+ }
+
+ public void doParse(boolean closeData) throws IOException
+ {
+ if (parseCalled)
+ {
+ throw new IOException(
+ "Implementation error: Parser called twice for same data.\n"
+ + "Need to call initData() again before parsing can be reattempted.");
+ }
+ parseCalled = true;
+ parse(this.doXferSettings);
+ if (closeData && !dataClosed)
+ {
+ dataIn.close();
+ dataClosed = true;
+ }