/** * Opens an existing data network from a string. * * @throws UdmException */ public void testOpenExistingFromString() throws UdmException, IOException { String xml = new String(""); RandomAccessFile raf = new RandomAccessFile(BM_FILE_IN, "r"); String line = null; while ((line = raf.readLine()) != null) { xml += (line + "\n"); } raf.close(); ContainerStringFactory gtf = FactoryRepository.getTimeSeriesContainerStringFactory(); UdmPseudoObject rootUPO = gtf.open(xml); Container con = null; if (rootUPO instanceof Container) { con = (Container) rootUPO; } else { fail("Unexpected root type: " + rootUPO.getType()); } System.out.println("\ntestOpenExistingFromString():\n"); printContainer(con); gtf.close(); }
/** * Opens an existing data network from a stream. * * @throws UdmException * @throws FileNotFoundException */ public void testOpenExistingFromStream() throws UdmException, FileNotFoundException { InputStream xml = null; xml = new FileInputStream(BM_FILE_IN); ContainerStringFactory gtf = FactoryRepository.getTimeSeriesContainerStringFactory(); UdmPseudoObject rootUPO = gtf.open(xml); Container con = null; if (rootUPO instanceof Container) { con = (Container) rootUPO; } else { fail("Unexpected root type: " + rootUPO.getType()); } System.out.println("\ntestOpenExistingFromStream():\n"); printContainer(con); gtf.close(); }