Writes out paragraph delimited content.

@param text the String content to output.
@param xml the XmlStringBuilder to paint to.
193947
private static void writeParagraphs(final String text, final XmlStringBuilder xml) {
		if (!Util.empty(text)) {
			int start = 0;
			int end = text.length() - 1;

			// Set the start index to the first non-linebreak, so we don't emit leading ui:nl tags
			for (; start < end; start++) {
				char c = text.charAt(start);

				if (c != '\n' && c != '\r') {
					break;
				}
			}

			// Set the end index to the last non-linebreak, so we don't emit trailing ui:nl tags
			for (; start < end; end--) {
				char c = text.charAt(end);

				if (c != '\n' && c != '\r') {
					break;
				}
			}

			char lastChar = 0;

			for (int i = start; i <= end; i++) {
				char c = text.charAt(i);

				if (c == '\n' || c == '\r') {
					if (lastChar != 0) {
						xml.write("<ui:nl/>");
					}

					lastChar = 0;
				} else {
					xml.write(c);
					lastChar = c;
				}
			}
		}
	}
792962
@Override
    public void writeText(Object text, UIComponent component, String property)
            throws IOException {
        getWrapped().writeText(text, component, property);
    }
783623
public void writeCharacters(char[] text, int start, int len)
			throws XMLStreamException {
		this.writeCharacters(new String(text, start, len));
	}
1127391
public void xmlWriteOn(FormattedWriter writer) throws IOException
  {
    writer.newLine();
    writer.taggedValue("tick", _tick);
    writer.taggedValue("protocolState", _protocolState);
  }
12174
@Override
    public void write(Writer out, boolean escapeXML) throws IOException {
        final String url = this.toURL();
        if (escapeXML) {
            StringEscapeUtils.escapeXml(out, url);
        } else {
            out.write(url);
        }
    }
8420
public void write(Writer out)
         throws IOException
    {
        writeHtmlHead(out);
        writeBodyTag(out);
        writeElements(out);
        writeHtmlEnd(out);
    }
958828
private void print(String text) {
    String indent = Strings.repeat(" ", mIndentationLevel * INDENT_SIZE);
    mPrintStream.println(indent + text);
  }
661483
public void print(String text) {
        try {
            out.write(text);
        } catch(IOException ioe) {
            throw new GroovyRuntimeException(ioe);
        }
    }
1368445
public final void xmlWriteOn(FormattedWriter writer, String tagName) throws IOException
    {
        Link link = getHead();
        if (link != null)
        {
            writer.newLine();
            writer.startTag(tagName);
            writer.indent();

            while (link != null)
            {
                writer.newLine();
                link.xmlWriteOn(writer);
                link = link.getNextPhysicalLink();
            }

            writer.outdent();
            writer.newLine();
            writer.endTag(tagName);
        }
    }
632093
public void write(String xmlFilename) throws CmsXmlException {

        // try to get it from the cache
        Document document = m_cache.get(xmlFilename);

        if (document != null) {
            try {
                CmsXmlUtils.validateXmlStructure(document, CmsEncoder.ENCODING_UTF_8, new CmsXmlEntityResolver(null));
                OutputStream out = null;
                out = new FileOutputStream(getFile(xmlFilename));
                CmsXmlUtils.marshal(document, out, CmsEncoder.ENCODING_UTF_8);
            } catch (FileNotFoundException e) {
                throw new CmsXmlException(new CmsMessageContainer(null, e.toString()));
            } catch (CmsXmlException e) {
                // write invalid config files to the file system with a prefix of "invalid-" so they can be inspected for errors
                try {
                    OutputStream invalidOut = new FileOutputStream(getFile("invalid-" + xmlFilename));
                    CmsXmlUtils.marshal(document, invalidOut, CmsEncoder.ENCODING_UTF_8);
                } catch (IOException e2) {
                    // ignore

                }
                throw e;
            }
        }
    }
826721
public final void writeXml(T property, Element element, WriteContext context) {
		XCalElement xcalElement = new XCalElement(element);
		_writeXml(property, xcalElement, context);
	}
717858
public void text(Object o) throws SAXException {
        if (o!=null)
            output.write(escape(o.toString()));
    }
1311804
protected void sendMessage(String xml) {
    byte[] bytes = null;
    try {
      bytes = xml.getBytes("UTF-8");
      writeBytes(bytes);
    } catch (SocketException se) {
      // when we get a socket exception, let's try to re-establish
      stop();
      start();
      try {
        writeBytes(bytes);
      } catch (IOException e) {
        throw new WebDriverException(e);
      }
    } catch (IOException e) {
      throw new WebDriverException(e);
    }
  }
1145965
protected void writeElementContent(String text, Writer out) throws IOException {
		// esccape '<', '&', ']]>', <32 if necessary
		int pos = 0;
		for (int i = 0; i < text.length(); i++) {
			// TODO: check if doing char[] text.getChars() would be faster than
			// getCharAt(i) ...
			char ch = text.charAt(i);
			if (ch == ']') {
				if (seenBracket) {
					seenBracketBracket = true;
				} else {
					seenBracket = true;
				}
			} else {
				if (ch == '&') {
					if (i > pos)
						out.write(text.substring(pos, i));
					out.write("&amp;");
					pos = i + 1;
				} else if (ch == '<') {
					if (i > pos)
						out.write(text.substring(pos, i));
					out.write("&lt;");
					pos = i + 1;
				} else if (seenBracketBracket && ch == '>') {
					if (i > pos)
						out.write(text.substring(pos, i));
					out.write("&gt;");
					pos = i + 1;
				} else if (ch < 32) {
					// in XML 1.0 only legal character are #x9 | #xA | #xD
					if (ch == 9 || ch == 10 || ch == 13) {
						// pass through

						// } else if(ch == 13) { //escape
						// if(i > pos) out.write(text.substring(pos, i));
						// out.write("&#");
						// out.write(Integer.toString(ch));
						// out.write(';');
						// pos = i + 1;
					} else {
						if (TRACE_ESCAPING)
							System.err.println(getClass().getName() + " DEBUG TEXT value.len=" + text.length() + " " + printable(text));
						throw new IllegalStateException("character " + Integer.toString(ch) + " is not allowed in output" + getLocation() + " (text value=" + printable(text) + ")");
						// in XML 1.1 legal are [#x1-#xD7FF]
						// if(ch > 0) {
						// if(i > pos) out.write(text.substring(pos, i));
						// out.write("&#");
						// out.write(Integer.toString(ch));
						// out.write(';');
						// pos = i + 1;
						// } else {
						// throw new IllegalStateException(
						// "character zero is not allowed in XML 1.1
						// output"+getLocation());
						// }
					}
				}
				if (seenBracket) {
					seenBracketBracket = seenBracket = false;
				}

			}
		}
		if (pos > 0) {
			out.write(text.substring(pos));
		} else {
			out.write(text); // this is shortcut to the most common case
		}

	}
1094844
@Override
    public void writeXML(XMLOutput xmlOutput) throws IOException {
        xmlOutput.openCloseTag(
                ELEMENT_NAME,
                new XMLAttributeList().addAttribute("sequence", String.valueOf(sequence))
                .addAttribute("timestamp", String.valueOf(timestamp)).addAttribute("release", releaseName)
                .addAttribute("codeSize", String.valueOf(codeSize))
                .addAttribute("numClasses", String.valueOf(numClasses)));
    }
997635
private void write(final Document document) throws IOException, TransformerException {
		TransformerFactory transformerFactory = TransformerFactory.newInstance();
		Transformer transformer = transformerFactory.newTransformer();
		transformer.setOutputProperty(OutputKeys.INDENT, "yes");
		transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
		transformer
				.setOutputProperty(OutputKeys.DOCTYPE_SYSTEM, "http://cobertura.sourceforge.net/xml/coverage-04.dtd");
		try (BufferedWriter bufferedWriter = Files.newBufferedWriter(this.reportPath)) {
			transformer.transform(new DOMSource(document), new StreamResult(bufferedWriter));
		}
	}
79014
public static void write(Node node, Writer writer, String charset, int indent) {
		transform(new DOMSource(node), new StreamResult(writer), charset, indent);
	}