Renders the viewport using an SVGRenderer to the given output writer.
@param vp
@param out
@throws IOException
331422
protected void writeSVG(Viewport vp, Writer out) throws IOException
    {
        //obtain the viewport bounds depending on whether we are clipping to viewport size or using the whole page
        int w = vp.getClippedContentBounds().width;
        int h = vp.getClippedContentBounds().height;
        
        SVGRenderer render = new SVGRenderer(w, h, out);
        vp.draw(render);
        render.close();
    }
132187
public void write(DataOutput out) throws IOException {
    taskId.write(out); 
    WritableUtils.writeVInt(out, idWithinJob);
    out.writeBoolean(isMap);
    WritableUtils.writeEnum(out, status); 
    WritableUtils.writeString(out, taskTrackerHttp);
    WritableUtils.writeVInt(out, taskRunTime);
    WritableUtils.writeVInt(out, eventId);
  }
308981
public static void setOutputStream(final OutputStream out) {
        LowLevelLogUtil.writer = new PrintWriter(Objects.requireNonNull(out), true);
    }
600468
public void write(DataOutput out) throws IOException {
        WritableUtils.writeVInt(out, length);
        out.write(bytes, 0, length);
    }
471633
public static void writeRawVarint32(OutputStream os, int value) throws IOException {
        while (true) {
            if ((value & ~0x7F) == 0) {
                os.write(value);
                return;
            } else {
                os.write((value & 0x7F) | 0x80);
                value >>>= 7;
            }
        }
    }
142647
public static void write(InputStream in, int bufferSize) {
		ServletOutputStream out = null;
		try {
			out = getOutputStream();
			IoUtil.copy(in, out, bufferSize);
		} catch (IOException e) {
			throw new RenderException("Error when output to client!", e);
		} finally {
			IoUtil.close(out);
			IoUtil.close(in);
		}
	}
1042656
public void printStartRecordData(Rec record, PrintWriter out, int iPrintOptions)
    {
        this.getScreenFieldView().printStartRecordData(record, out, iPrintOptions);
    }
987482
private void renderAsDT(Writer writer, ProjectModel project, Iterator<Link> links, boolean wrap) throws IOException
    {
        if (!links.hasNext())
            return;

        if (wrap)
            writer.append("<dl>");
        while (links.hasNext())
        {
            Link link = links.next();
            writer.append("<dt>").append(link.getDescription());
            writer.append("</dt><dd><a href='").append(link.getLink());
            appendProject(writer, project);
            writer.append("'>Link</a></dd>");
        }
        if (wrap)
            writer.append("</dl>");
    }
694355
void write(ObjectOutputStream out) throws IOException {
        PutField fields = out.putFields();

        fields.put(CONTEXT, threadContextDescriptor.serialize());

        fields.put(EXEC_PROPS, threadContextDescriptor.getExecutionProperties());

        fields.put(INTERNAL_PROP_NAMES, internalPropNames);

        ByteArrayOutputStream bout = new ByteArrayOutputStream();
        ObjectOutputStream oout = new ObjectOutputStream(bout);
        oout.writeObject(object);
        oout.flush();
        fields.put(OBJECT, bout.toByteArray());
        oout.close();

        out.writeFields();
    }
89188
public void write(OutputStream out)
         throws IOException
    {
        Writer writer = new OutputStreamWriter(out);
        write(writer);
        writer.flush();
    }
403386
public final void writeTo(String fmt, OutputStream out) throws IOException {
        if (fmt.equalsIgnoreCase(SVG_FMT)) {
            out.write(toSvgStr().getBytes(Charsets.UTF_8));
        } else if (fmt.equalsIgnoreCase(PS_FMT)) {
            out.write(toEpsStr().getBytes(Charsets.UTF_8));
        } else if (fmt.equalsIgnoreCase(PDF_FMT)) {
            out.write(toPdfStr().getBytes(Charsets.UTF_8));
        } else {
            ImageIO.write(toImg(), fmt, out);
        }
    }
232684
public static void write(Object value, Writer out) throws IOException {
		if(out instanceof MediaWriter) {
			// Unwrap media writer and use encoder directly
			MediaWriter mediaWriter = (MediaWriter)out;
			write(
				value,
				mediaWriter.getEncoder(),
				mediaWriter.getOut()
			);
		} else {
			if(value instanceof String) {
				// If A is a string, then the result is A.
				out.write((String)value);
			} else if(value == null) {
				// Otherwise, if A is null, then the result is "".
				// Write nothing
			} else if(value instanceof Writable) {
				Writable writable = (Writable)value;
				if(writable.isFastToString()) {
					out.write(writable.toString());
				} else {
					// Avoid intermediate String from Writable
					writable.writeTo(unwrap(out));
				}
			} else if(value instanceof Node) {
				// Otherwise, if is a DOM node, serialize the output
				try {
					// Can use thread-local or pooled transformers if performance is ever an issue
					TransformerFactory transFactory = TransformerFactory.newInstance();
					Transformer transformer = transFactory.newTransformer();
					transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
					transformer.transform(
						new DOMSource((Node)value),
						new StreamResult(unwrap(out))
					);
				} catch(TransformerException e) {
					throw new IOException(e);
				}
			} else {
				// Otherwise, if A.toString() throws an exception, then raise an error
				// Otherwise, the result is A.toString();
				out.write(value.toString());
			}
		}
	}
136042
@SuppressWarnings({"WeakerAccess", "unused"})
   public void  renderToCanvas(Canvas canvas, RectF viewPort)
   {
      RenderOptions  renderOptions = new RenderOptions();

      if (viewPort != null) {
         renderOptions.viewPort(viewPort.left, viewPort.top, viewPort.width(), viewPort.height());
      } else {
         renderOptions.viewPort(0f, 0f, (float) canvas.getWidth(), (float) canvas.getHeight());
      }

      SVGAndroidRenderer  renderer = new SVGAndroidRenderer(canvas, this.renderDPI);

      renderer.renderDocument(this, renderOptions);
   }
670217
public void export(Iterator<Variant> iterator) {
        // sanity check
        if (writer == null) {
            logger.error("Error exporting VCF data: exporter must be opened");
            return;
        }

        // main loop (from iterator)
        while (iterator.hasNext()) {
            try {
                VariantContext variantContext = variantConverter.convert(iterator.next());
                //System.out.println(variantContext.toString());
                writer.add(variantContext);
            } catch (Exception e) {
                logger.error("Error exporting VCF data: {}", e.getMessage(), e);
            }
        }

//      // close everything
//      close();
    }
422179
public void render() throws IOException {
		if (isDisposed()) {
			LOG.debug("Skipping render phase.");
			return;
		}

		try {
			// Check user context has been prepared
			if (getNewConversation() == null) {
				throw new IllegalStateException(
						"User context has not been prepared before the render phase");
			}

			prepareRender();

			UIContext uic = getUIContext();
			if (uic == null) {
				throw new IllegalStateException("No user context set for the render phase.");
			}

			UIContextHolder.pushContext(uic);
			prepareRequest();

			// Handle errors from the action phase now.
			if (havePropogatedError()) {
				handleError(getPropogatedError());
				return;
			}

			WComponent uiComponent = getUI();

			if (uiComponent == null) {
				throw new SystemException("No UI Component exists.");
			}

			Environment environment = uiComponent.getEnvironment();

			if (environment == null) {
				throw new SystemException("No WEnvironment exists.");
			}

			getInterceptor().attachResponse(getResponse());
			getInterceptor().preparePaint(getRequest());

			String contentType = getUI().getHeaders().getContentType();
			Response response = getResponse();
			response.setContentType(contentType);

			addGenericHeaders(uic, getUI());

			PrintWriter writer = getPrintWriter();
			getInterceptor().paint(new WebXmlRenderContext(writer, uic.getLocale()));

			// The following only matters for a Portal context
			String title = uiComponent instanceof WApplication ? ((WApplication) uiComponent).
					getTitle() : null;

			if (title != null) {
				setTitle(title);
			}
		} catch (Escape esc) {
			LOG.debug("Escape performed during render phase.");
			handleEscape(esc);
		} catch (Throwable t) {
			// We try not to let any exception propagate to container.
			String message = "Caught exception during render phase.";
			LOG.error(message, t);
			handleError(t);
		} finally {
			UIContextHolder.reset();
			dispose();
		}
	}
511083
function SVGRenderer(generator, config, logger, document) {
        BaseRenderer.call(this, generator, config, logger, document);
        
        if (config.hasOwnProperty("svgomg-enabled")) {
            this._useSVGOMG = !!config["svgomg-enabled"];
        }
    }
745516
@Override
  public void write(TextWriterStream out, String label, int[] v) {
    StringBuilder buf = new StringBuilder();
    if(label != null) {
      buf.append(label).append('=');
    }
    if(v != null) {
      FormatUtil.formatTo(buf, v, " ");
    }
    out.inlinePrintNoQuotes(buf.toString());
  }