Method write.

@param project
@param writer
@param document
972229
public void write(Model project, Document document, String encoding, OutputStreamWriter writer)
            throws java.io.IOException
   {
      Format format = Format.getRawFormat().setEncoding(encoding).setLineSeparator(LS);
      write(project, document, writer, format);
   }
1187546
protected void writeDocumentTrailer(XMLEventWriter writer)
            throws JournalException {
        try {
            putEndDocument(writer);
        } catch (XMLStreamException e) {
            throw new JournalException(e);
        }
    }
65251
public static void writeFile(final Document input, final File output) {
        final StreamResult result = new StreamResult(new StringWriter());

        format(new DOMSource(input), result);

        try {
            new FileWriter(output).write(result.getWriter().toString());
        } catch (final IOException ioEx) {
            LOGGER.error("Problem writing XML to file.", ioEx);
        }
    }
741276
public void write(Writer writer)
        throws IOException
    {
        synchronized(writer)
        {
            for (int i=0;i<_fields.size();i++)
            {
                Field field=(Field)_fields.get(i);
                if (field!=null)
                    field.write(writer,_version);
            }
            writer.write(__CRLF);
        }
    }
432904
public void write(Writer writer, Map<String, String> outputProperties) throws TransformerException {
		Transformer transformer;
		try {
			transformer = TransformerFactory.newInstance().newTransformer();
		} catch (TransformerConfigurationException e) {
			//should never be thrown because we're not doing anything fancy with the configuration
			throw new RuntimeException(e);
		} catch (TransformerFactoryConfigurationError e) {
			//should never be thrown because we're not doing anything fancy with the configuration
			throw new RuntimeException(e);
		}

		/*
		 * Using Transformer#setOutputProperties(Properties) doesn't work for
		 * some reason for setting the number of indentation spaces.
		 */
		for (Map.Entry<String, String> entry : outputProperties.entrySet()) {
			String key = entry.getKey();
			String value = entry.getValue();
			transformer.setOutputProperty(key, value);
		}

		DOMSource source = new DOMSource(document);
		StreamResult result = new StreamResult(writer);
		transformer.transform(source, result);
	}
604905
public void write() throws Exception {
    PrintWriter out;
    String output = output();

    if (outFile != null) {
      out = new PrintWriter(Files.newBufferedWriter(outFile.toPath(), UTF_8));
    } else if (inPlace) {
      assert docFile != null
          : "@AssumeAssertion(nullness): dependent: docFile is non-null if inPlace is true";
      out = new PrintWriter(Files.newBufferedWriter(docFile.toPath(), UTF_8));
    } else {
      out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out, UTF_8)));
    }

    out.println(output);
    out.flush();
    out.close();
  }
19917
private void writeObject(java.io.ObjectOutputStream out) throws IOException
	{
		if (delegateMethods != null)
		{
			delegateMethods.clear();
		}

		out.defaultWriteObject();
	}
37064
public static final void writeScript(Writer writer)
   throws IOException
   {
	   String newline = IO.newline();
	   
	   boolean isWindows = System.getProperty("os.name").startsWith("Windows");
	   
	   String variablePrefix = "$C";
	   String variableSuffix = File.pathSeparator;
	   
	   if(isWindows)
	   {
		   variablePrefix = "%C";
		   variableSuffix = "%"+File.pathSeparator;
	   }
	   
	String setSyntax = isWindows ? "@set " : "export ";
	   
	String classpath = System.getProperty(CLASSPATH_PROP);
	
	String cpath = null;
	
	HashMap<String, HashSet<Object>> map = new HashMap<String, HashSet<Object>>();
	String folderPath = null;
	HashSet<Object> folderPathClassPaths = null;
	
	for(StringTokenizer tok = new StringTokenizer(classpath,File.pathSeparator);tok.hasMoreTokens();)
	{
	   cpath = tok.nextToken();
	   
	   //get path
	   folderPath = IO.parseFolderPath(cpath);
	   
	   //System.out.println("folderPath="+folderPath);
	   
	   //get list for folder path
	   folderPathClassPaths = (HashSet<Object>)map.get(folderPath);
	   
	   //create if needed
	   if(folderPathClassPaths == null)
	   {
		folderPathClassPaths = new HashSet<Object>();
	   }
	   
	   folderPathClassPaths.add(cpath);
	   
	   //put in map
	   map.put(folderPath, folderPathClassPaths);	   	   
	   
	}	
	
	//loop thru keys in map
	int cnt = 0;
	
	
	for(Map.Entry<String, HashSet<Object>> entry : map.entrySet())
	{
	   folderPath = entry.getKey();
	   
	   //get list of classpaths
	   folderPathClassPaths =  entry.getValue();
	   
	   //write variable
	   writer.write(IO.newline());
	   writer.write(setSyntax);
	   writer.write(new StringBuilder(" C").append(cnt).append("=").toString());
	   
	   
	   //loop thru paths
	   int printedCnt = 0;
	   
	   String line = null;
	   for(Iterator<Object> pathI = folderPathClassPaths.iterator();pathI.hasNext();)
	   {
		//limit number of entries per path
		if(printedCnt > limitPerPath)
		{
		   //increment
		   cnt++;
		   
		   writer.write(newline);
		   
		   writer.write(new StringBuilder(setSyntax).append(" C").append(cnt).append("=").toString());
		   
		   printedCnt = 0;
		   
		}
		
		
		
		
		
		line = pathI.next().toString();
		writer.write(line);
		
		printedCnt += line.length();
		
		writer.write(File.pathSeparator);
		
	   }
	   writer.write(newline);
	   writer.write(newline);
	   
	   writer.flush();
	   
	}
	
	//print classpath
	writer.write(setSyntax); writer.write(" CLASSPATH=");
	
	for(int i=0; i <cnt;i++)
	{
	   writer.write(variablePrefix+i);
	   writer.write(variableSuffix);
	   
	}
	writer.write(newline);
	writer.write(newline);
	
	
	writer.write("java <CLASS> <ARG>");


	writer.flush();
	
	writer.write(newline);
	
	writer.write("java  junit.textui.TestRunner <CLASS> <ARG>");
	writer.write(newline);
	
	writer.flush();
	
	
	//System.out.println("File.pathSeparator="+File.pathSeparator);
	//System.out.println("File.separator="+File.separator);
	
	
   }
618540
public void writeDocument(String filename, ProvFormat format, Document document) {
        Namespace.withThreadNamespace(document.getNamespace());
        try {
            logger.debug("writing " + format);
            logger.debug("writing " + filename);
            setNamespaces(document);
            switch (format) {
            case PROVN: {
                u.writeDocument(document, filename, pFactory);
                break;
            }
            case XML: {
                ProvSerialiser serial = ProvSerialiser
                        .getThreadProvSerialiser();
                logger.debug("namespaces " + document.getNamespace());
                serial.serialiseDocument(new File(filename), document, true);
                break;
            }
            case TURTLE: {
                new org.openprovenance.prov.rdf.Utility(pFactory, onto)
                        .dumpRDF(document, RDFFormat.TURTLE, filename);
                break;
            }
            case RDFXML: {
                new org.openprovenance.prov.rdf.Utility(pFactory, onto)
                        .dumpRDF(document, RDFFormat.RDFXML, filename);
                break;
            }
            case TRIG: {
                new org.openprovenance.prov.rdf.Utility(pFactory, onto)
                        .dumpRDF(document, RDFFormat.TRIG, filename);
                break;
            }
            case JSON: {
                new org.openprovenance.prov.json.Converter(pFactory)
                        .writeDocument(document, filename);
                break;
            }
            case DOT: {
                String configFile = null; // TODO: get it as option
                ProvToDot toDot = (configFile == null) ? new ProvToDot(
                        ProvToDot.Config.ROLE_NO_LABEL) : new ProvToDot(
                        configFile);
                toDot.setLayout(layout);
                toDot.convert(document, filename, title);
                break;
            }
            case PDF:
            case JPEG:
            case PNG:
            case SVG: {
                String configFile = null; // give it as option
                File tmp = File.createTempFile("viz-", ".dot");

                String dotFileOut = tmp.getAbsolutePath(); // give it as option,
                                                           // if not available
                                                           // create tmp file
                ProvToDot toDot;
                if (configFile != null) {
                    toDot = new ProvToDot(configFile);
                } else {
                    toDot = new ProvToDot(ProvToDot.Config.ROLE_NO_LABEL);
                }
                toDot.setLayout(layout);
                toDot.convert(document, dotFileOut, filename, extensionMap.get(format), title);
                tmp.delete();
                break;
            }

            default:
                break;
            }
        } catch (JAXBException e) {
            if (verbose != null)
                e.printStackTrace();
            throw new InteropException(e);

        } catch (IOException e) {
            if (verbose != null)
                e.printStackTrace();
            throw new InteropException(e);
        }

    }
673565
public void write(String path){

		File f = new File(path);		
		if(!f.exists()){
			f.mkdirs();
		}

		Iterator<FNLPDoc> it = docs.iterator();
		while(it.hasNext()){
			FNLPDoc doc = it.next();
			doc.write(path);
		}

	}
21898
public void writeContent(final OutputStream result) throws IOException
    {
    	result.write(OPEN_GROUP);
		result.write(GENERATOR);
		result.write(DELIMITER);
		result.write(DocWriter.getISOBytes(Document.getVersion()));
		result.write(CLOSE_GROUP);
		this.document.outputDebugLinebreak(result);
    }
1207423
public void writePom(File file) throws ProjectException {
        log.debug("Writing pom: {}", file.getPath());

        Project copy = this;
        copy.removeProperty( "project.basedir" );

        Writer writer;
        try {
            writer = new BufferedWriter(new FileWriter(file));
        } catch (IOException e) {
            throw new ProjectException(e);
        }

        MavenXpp3Writer pomWriter = new MavenXpp3Writer();
        try {
            pomWriter.write(writer, copy.mavenModel);
        } catch (IOException e) {
            throw new ProjectException("Failed to write pom", e);
        }
    }
370669
private void writeResources() throws IOException
   {
      writeAttributeTypes("resource_types", ResourceField.values());

      m_writer.writeStartList("resources");
      for (Resource resource : m_projectFile.getResources())
      {
         writeFields(null, resource, ResourceField.values());
      }
      m_writer.writeEndList();
   }
345084
public void write(Collection<?> objects, boolean allOrNothing, OutputStream out) {
		try {
			JsonGenerator jg = objectMapper.getFactory().createGenerator(out, JsonEncoding.UTF8);
			jg.writeStartObject();
			if (allOrNothing) {
				jg.writeBooleanField("all_or_nothing", true);
			}
			jg.writeArrayFieldStart("docs");
			for (Object o : objects) {
				jg.writeObject(o);
			}
			jg.writeEndArray();
			jg.writeEndObject();
			jg.flush();
			jg.close();
		} catch (Exception e) {
			throw Exceptions.propagate(e);
		} finally {
			IOUtils.closeQuietly(out);
		}
	}
795902
public void fireCalendarWrittenEvent(ProjectCalendar calendar)
   {
      if (m_projectListeners != null)
      {
         for (ProjectListener listener : m_projectListeners)
         {
            listener.calendarWritten(calendar);
         }
      }
   }
353072
public static void writeConsoleNoDocType(Document ele, Writer out)
    throws IOException {
        XMLSerializer serializer =
                new XMLSerializer(out, CONSOLE_NO_DOCTYPE);
        serializer.serialize(ele);
    }
788059
private void writeTasks(Project project)
   {
      Project.Tasks tasks = m_factory.createProjectTasks();
      project.setTasks(tasks);
      List<Project.Tasks.Task> list = tasks.getTask();

      for (Task task : m_projectFile.getTasks())
      {
         list.add(writeTask(task));
      }
   }