Search in sources :

Example 1 with NoCloseAllowedReader

use of net.parostroj.timetable.model.save.NoCloseAllowedReader in project grafikon by jub77.

the class LSSerializerImpl1 method load.

@Override
public TrainDiagram load(Reader reader, LSTrainTypeList trainTypeList) throws LSException {
    try {
        LSTrainDiagram lsDiagram = (LSTrainDiagram) unmarshaller.unmarshal(new NoCloseAllowedReader(reader));
        LSVisitorBuilder builderVisitor = new LSVisitorBuilder(trainTypeList);
        lsDiagram.visit(builderVisitor);
        return builderVisitor.getTrainDiagram();
    } catch (JAXBException e) {
        throw new LSException("Cannot load train diagram.", e);
    }
}
Also used : NoCloseAllowedReader(net.parostroj.timetable.model.save.NoCloseAllowedReader) JAXBException(javax.xml.bind.JAXBException) LSException(net.parostroj.timetable.model.ls.LSException)

Example 2 with NoCloseAllowedReader

use of net.parostroj.timetable.model.save.NoCloseAllowedReader in project grafikon by jub77.

the class LSSerializerImpl2 method load.

@Override
public TrainDiagram load(Reader reader, LSTrainTypeList trainTypeList) throws LSException {
    try {
        LSTrainDiagram lsDiagram = (LSTrainDiagram) unmarshaller.unmarshal(new NoCloseAllowedReader(reader));
        LSVisitorBuilder builderVisitor = new LSVisitorBuilder(trainTypeList);
        lsDiagram.visit(builderVisitor);
        return builderVisitor.getTrainDiagram();
    } catch (JAXBException e) {
        throw new LSException("Cannot load train diagram.", e);
    }
}
Also used : NoCloseAllowedReader(net.parostroj.timetable.model.save.NoCloseAllowedReader) JAXBException(javax.xml.bind.JAXBException) LSException(net.parostroj.timetable.model.ls.LSException)

Aggregations

JAXBException (javax.xml.bind.JAXBException)2 LSException (net.parostroj.timetable.model.ls.LSException)2 NoCloseAllowedReader (net.parostroj.timetable.model.save.NoCloseAllowedReader)2