/**
   * Opens an existing data network from a string and saves as a stream.
   *
   * @throws UdmException
   * @throws IOException
   */
  public void testOpenExistingFromStringSaveToStream() 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());
    }

    InputStream a = gtf.saveAsStream();
    System.out.println("\ntestOpenExistingFromStringSaveToStream():\n" + a);
    printInputStream(a);
  }
  /**
   * Opens an existing data network from a stream and saves in a string.
   *
   * @throws UdmException
   * @throws FileNotFoundException
   */
  public void testOpenExistingFromStreamSaveToString() 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());
    }

    String a = gtf.save();
    System.out.println("\ntestOpenExistingFromStreamSaveToString():\n" + a);
  }