code: @Override public void write(ProjectFile projectFile, OutputStream stream) throws IOException
     {
        try
        {
           m_projectFile = projectFile;
           m_eventManager = projectFile.getEventManager();
  
           if (CONTEXT == null)
           {
              throw CONTEXT_EXCEPTION;
           }
  
           Marshaller marshaller = CONTEXT.createMarshaller();
           marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
           if (m_encoding != null)
           {
              marshaller.setProperty(Marshaller.JAXB_ENCODING, m_encoding);
           }
  
           //
           // The Planner implementation used  as the basis for this work, 0.14.1
           // does not appear to have a particularly robust parser, and rejects
           // files with the full XML declaration produced by JAXB. The
           // following property suppresses this declaration.
           //
           marshaller.setProperty(Marshaller.JAXB_FRAGMENT, Boolean.TRUE);
  
           m_factory = new ObjectFactory();
           m_plannerProject = m_factory.createProject();
  
           writeProjectProperties();
           writeCalendars();
           writeResources();
           writeTasks();
           writeAssignments();
  
           marshaller.marshal(m_plannerProject, stream);
        }
  
        catch (JAXBException ex)
        {
           throw new IOException(ex.toString());
        }
  
        finally
        {
           m_projectFile = null;
           m_factory = null;
           m_plannerProject = null;
        }
     }
docs: {@inheritDoc}