Changed the XML reader to take an InputStream rather than InputSource- this has changed everything that used an InputSource to use an InputStream. Made the XML Readers actually read after they received a new InputStream. Changed it so the table updates when the boats in the race change. #pair[jjg64, cbt24] #story[782]

This commit is contained in:
Joseph Gardner
2017-05-01 16:42:47 +12:00
parent 3f42d56502
commit 41a94495aa
12 changed files with 42 additions and 28 deletions
@@ -11,6 +11,7 @@ import seng302.XMLReader;
import javax.xml.parsers.ParserConfigurationException;
import java.io.IOException;
import java.io.InputStream;
import java.lang.annotation.ElementType;
import java.text.ParseException;
import java.util.*;
@@ -48,8 +49,9 @@ public class BoatXMLReader extends XMLReader {
}
}
public BoatXMLReader(InputSource xmlString) throws IOException, SAXException, ParserConfigurationException {
public BoatXMLReader(InputStream xmlString) throws IOException, SAXException, ParserConfigurationException {
super(xmlString);
read();
}
public void read() {
@@ -8,6 +8,7 @@ import seng302.XMLReader;
import javax.xml.parsers.ParserConfigurationException;
import java.io.IOException;
import java.io.InputStream;
/**
* Created by jjg64 on 19/04/17.
@@ -43,8 +44,9 @@ public class RegattaXMLReader extends XMLReader {
}
}
public RegattaXMLReader(InputSource xmlString) throws IOException, SAXException, ParserConfigurationException {
public RegattaXMLReader(InputStream xmlString) throws IOException, SAXException, ParserConfigurationException {
super(xmlString);
read();
}
/**
@@ -31,6 +31,8 @@ public class StreamedCourse extends Observable implements RaceDataSource {
boatXMLReader.setParticipants(streamedCourseXMLReader.getParticipants());
boatXMLReader.read();
}
setChanged();
notifyObservers();
}
public StreamedCourseXMLReader getStreamedCourseXMLReader() {
@@ -14,6 +14,7 @@ import seng302.XMLReader;
import javax.xml.parsers.ParserConfigurationException;
import java.io.IOException;
import java.io.InputStream;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
@@ -64,12 +65,13 @@ public class StreamedCourseXMLReader extends XMLReader {
}
}
public StreamedCourseXMLReader(InputSource xmlString) throws IOException, SAXException, ParserConfigurationException {
public StreamedCourseXMLReader(InputStream xmlString) throws IOException, SAXException, ParserConfigurationException, ParseException, StreamedCourseXMLException {
super(xmlString);
read();
}
private void read() throws ParseException, StreamedCourseXMLException {
readRace();
// readRace();
readParticipants();
readCourse();
}