code: private void writeTask(Task record) throws IOException
     {
        m_buffer.setLength(0);
  
        //
        // Write the task
        //
        int[] fields = m_taskModel.getModel();
        int field;
  
        m_buffer.append(MPXConstants.TASK_RECORD_NUMBER);
        for (int loop = 0; loop < fields.length; loop++)
        {
           field = fields[loop];
           if (field == -1)
           {
              break;
           }
  
           TaskField taskField = MPXTaskField.getMpxjField(field);
           Object value = record.getCachedValue(taskField);
           value = formatType(taskField.getDataType(), value);
  
           m_buffer.append(m_delimiter);
           m_buffer.append(format(value));
        }
  
        stripTrailingDelimiters(m_buffer);
        m_buffer.append(MPXConstants.EOL);
        m_writer.write(m_buffer.toString());
  
        //
        // Write the task notes
        //
        String notes = record.getNotes();
        if (notes.length() != 0)
        {
           writeNotes(MPXConstants.TASK_NOTES_RECORD_NUMBER, notes);
        }
  
        //
        // Write the recurring task
        //
        if (record.getRecurringTask() != null)
        {
           writeRecurringTask(record.getRecurringTask());
        }
  
        //
        // Write any resource assignments
        //
        if (record.getResourceAssignments().isEmpty() == false)
        {
           for (ResourceAssignment assignment : record.getResourceAssignments())
           {
              writeResourceAssignment(assignment);
           }
        }
  
        m_eventManager.fireTaskWrittenEvent(record);
     }
docs: Write a task.
  
  @param record task instance
  @throws IOException