Package org.somda.sdc.glue.common
Class MdibXmlIo
java.lang.Object
org.somda.sdc.glue.common.MdibXmlIo
Utility class to read an Mdib from an input stream (or file).
-
Method Summary
Modifier and TypeMethodDescriptionReads an MDIB from a file input.readMdib(InputStream getMdibResponseStream) Reads the MDIB from an input stream.voidWrites an MDIB to an file.voidwriteMdib(Mdib mdib, OutputStream outputStream) Writes an MDIB to an output stream.
-
Method Details
-
readMdib
public Mdib readMdib(InputStream getMdibResponseStream) throws javax.xml.bind.JAXBException, ClassCastException Reads the MDIB from an input stream.- Parameters:
getMdibResponseStream- the input stream to read from.- Returns:
- the parsed
Mdib. - Throws:
javax.xml.bind.JAXBException- in case JAXB cannot parse the input stream.ClassCastException- if something unexpected was read in.
-
readMdib
public Mdib readMdib(File getMdibResponseFile) throws javax.xml.bind.JAXBException, ClassCastException, IOException Reads an MDIB from a file input.- Parameters:
getMdibResponseFile- the file to read from.- Returns:
- the parsed
Mdib. - Throws:
javax.xml.bind.JAXBException- in case JAXB cannot parse the input stream.ClassCastException- if something unexpected was read in.IOException- if any IO issues come up, e.g., the object tried to access a file that does not exist.
-
writeMdib
Writes an MDIB to an output stream.- Parameters:
mdib- the MDIB to write.outputStream- the output stream where to write the marshalled XML to.- Throws:
javax.xml.bind.JAXBException- in case the marshaller throws an exception.
-
writeMdib
Writes an MDIB to an file.- Parameters:
mdib- the MDIB to write.outputFile- the output file where to write the marshalled XML to.- Throws:
javax.xml.bind.JAXBException- in case the marshaller throws an exception.IOException- in case any IO issue comes up, e.g. the file cannot be created.
-