Class MdibXmlIo


  • public class MdibXmlIo
    extends Object
    Utility class to read an Mdib from an input stream (or file).
    • Method Detail

      • 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

        public void writeMdib​(Mdib mdib,
                              OutputStream outputStream)
                       throws javax.xml.bind.JAXBException
        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

        public void writeMdib​(Mdib mdib,
                              File outputFile)
                       throws javax.xml.bind.JAXBException,
                              IOException
        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.