code: @Override public void write(ProjectFile projectFile, OutputStream stream) throws IOException
     {
        try
        {
           if (CONTEXT == null)
           {
              throw CONTEXT_EXCEPTION;
           }
  
           m_projectFile = projectFile;
           m_projectFile.validateUniqueIDsForMicrosoftProject();
           m_eventManager = m_projectFile.getEventManager();
           DatatypeConverter.setParentFile(m_projectFile);
  
           Marshaller marshaller = CONTEXT.createMarshaller();
           marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
  
           m_extendedAttributesInUse = new HashSet<FieldType>();
  
           m_factory = new ObjectFactory();
           Project project = m_factory.createProject();
  
           writeProjectProperties(project);
           writeCalendars(project);
           writeResources(project);
           writeTasks(project);
           writeAssignments(project);
           writeProjectExtendedAttributes(project);
  
           marshaller.marshal(project, stream);
        }
  
        catch (JAXBException ex)
        {
           throw new IOException(ex.toString());
        }
  
        finally
        {
           m_projectFile = null;
           m_factory = null;
           m_extendedAttributesInUse = null;
        }
     }
docs: {@inheritDoc}