Writes the given type to the {@link PrintWriter}.

@param packageName the package for the type
@param type the type
@param printWriter the writer
@throws com.google.gwt.core.ext.UnableToCompleteException if an exception is thrown by the writer
484251
protected final void write( String packageName, TypeSpec type, PrintWriter printWriter ) throws UnableToCompleteException {
        try {
            JavaFile.builder( packageName, type )
                    .build()
                    .writeTo( printWriter );
            context.commit( logger, printWriter );
        } catch ( IOException e ) {
            logger.log( TreeLogger.Type.ERROR, "Error writing the file " + packageName + "." + type.name, e );
            throw new UnableToCompleteException();
        }
    }
1016595
@Override
   public void writeClassBody(Definition def, Writer out) throws IOException
   {
      if (def.isUseAnnotation())
      {
         if (!def.isDefaultPackageInbound())
         {
            out.write("@Activation(messageListeners = { " + def.getMlClass() + ".class })\n");
         }
         else
         {
            out.write("@Activation(messageListeners = { " + def.getRaPackage() +
                  ".inflow." + def.getMlClass() + ".class })\n");
         }
      }
      out.write("public class " + getClassName(def) + " implements ActivationSpec");
      writeLeftCurlyBracket(out, 0);
      writeEol(out);

      int indent = 1;
      writeWithIndent(out, indent, "/** The logger */\n");
      writeWithIndent(out, indent, "private static Logger log = Logger.getLogger(" + getSelfClassName(def) + ");\n\n");

      writeWithIndent(out, indent, "/** The resource adapter */\n");
      writeWithIndent(out, indent, "private ResourceAdapter ra;\n\n");

      writeConfigPropsDeclare(def, out, indent);

      writeDefaultConstructor(def, out, indent);

      writeConfigProps(def, out, indent);

      writeValidate(def, out, indent);
      writeResourceAdapter(def, out, indent);

      writeRightCurlyBracket(out, 0);
   }
710266
public <T> ExcelDataWriter<?> registerDataWriter(Class<T> type, ExcelDataWriter<T> writer) {
        if (writer != null) {
            return writers.put(type, writer);
        } else {
            return null;
        }
    }
1220420
public void write(Writer out)
            throws XmlModelWriterException, IOException
    {
        try
        {
            DOMSource domSource = new DOMSource(_doc);
            StreamResult streamResult = new StreamResult(out);
            TransformerFactory tf = TransformerFactory.newInstance();
            tf.setAttribute("indent-number", new Integer(INDENT_LEN));
            Transformer serializer = tf.newTransformer();
            if (_publicID != null) {
                serializer.setOutputProperty(OutputKeys.DOCTYPE_PUBLIC, _publicID);
            }
            if (_systemID != null) {
                serializer.setOutputProperty(OutputKeys.DOCTYPE_SYSTEM, _systemID);
            }
            serializer.setOutputProperty(OutputKeys.INDENT, "yes");
            serializer.transform(domSource, streamResult);
        }
        catch (TransformerException e)
        {
            throw new XmlModelWriterException(e);
        }
    }
691624
public void write(List<NodeTypeData> nodeTypes, OutputStream os) throws RepositoryException
   {
      OutputStreamWriter out = new OutputStreamWriter(os);
      try
      {
         for (NodeTypeData nodeType : nodeTypes)
         {
            printNamespaces(nodeType, out);
            printNodeTypeDeclaration(nodeType, out);
         }
         out.close();
      }
      catch (IOException e)
      {
         throw new RepositoryException(e.getMessage(), e);
      }

   }
242026
public void writePostamble(final XMLUtil util, final ZipUTF8Writer writer) throws IOException {
        if (this.autofilters != null) this.appendAutofilters(writer, util);
        writer.write("</office:spreadsheet>");
        writer.write("</office:body>");
        writer.write("</office:document-content>");
        writer.flush();
        writer.closeEntry();
    }
248905
public void addImport(String type) throws IOException {
    Matcher matcher = TYPE_PATTERN.matcher(type);
    if (!matcher.matches()) {
      throw new IllegalArgumentException(type);
    }
    if (importedTypes.put(type, matcher.group(1)) != null) {
      throw new IllegalArgumentException(type);
    }
    out.write("import ");
    out.write(type);
    out.write(";\n");
  }
782804
public static void writeNode(Node node, List<BelTerm> supportingTerms,
            PrintWriter writer) {
        int x = new Random().nextInt(200);
        int y = new Random().nextInt(200);

        StringBuilder sb = new StringBuilder();
        sb.append("  <node label='");
        sb.append(node.label);
        sb.append("' id='");
        sb.append(node.id.toString());
        sb.append("'>\n");
        sb.append("    <att name='function type'");
        sb.append(" value='");
        sb.append(node.function.getDisplayValue());
        sb.append("' />\n");
        sb.append("    <att name='parameters'");
        sb.append(" value='");

        String params = "";
        for (BelTerm t : supportingTerms) {
            if (hasLength(params)) {
                params = params.concat("&#10;");
            }
            String label = t.getLabel();
            label = label.replaceAll("&", "&amp;");
            label = label.replaceAll("'", "&quot;");
            params = params.concat(label);
        }
        sb.append(params);
        sb.append("' />\n");

        // Graphics type and fill color
        String graphics = format(NODE_GRAPHICS, type(node.function),
                color(node.function), x, y, params);
        sb.append(graphics);

        sb.append("  </node>\n");
        writer.write(sb.toString());
    }
264344
public void setType(DBFDataType type) {
		if (!type.isWriteSupported()) {
			throw new IllegalArgumentException("No support for writting " + type);
		}
		this.type = type;
		if (type.getDefaultSize() > 0) {
			this.length = type.getDefaultSize();
		}

	}
512746
private void writeBean(Bean bean, Class<?> declaredType) throws IOException {
        output.writeObjectStart();
        // property information
        for (MetaProperty<?> prop : bean.metaBean().metaPropertyIterable()) {
            if (prop.style().isSerializable() || (prop.style().isDerived() && settings.isIncludeDerived())) {
                Object value = SerOptional.extractValue(prop, bean);
                if (value != null) {
                    output.writeObjectKey(prop.name());
                    Class<?> propType = SerOptional.extractType(prop, bean.getClass());
                    if (value instanceof Bean) {
                        if (settings.getConverter().isConvertible(value.getClass())) {
                            writeSimple(propType, value);
                        } else {
                            writeBean((Bean) value, propType);
                        }
                    } else {
                        SerIterator itemIterator = settings.getIteratorFactory().create(value, prop, bean.getClass(), true);
                        if (itemIterator != null) {
                            writeElements(itemIterator);
                        } else {
                            writeSimple(propType, value);
                        }
                    }
                }
            }
        }
        output.writeObjectEnd();
    }
943525
@Override
	public void writeBundleTo(String bundlePath, Writer writer) throws ResourceNotFoundException {

		Reader rd = null;

		try {

			// If debug mode is on, resources are retrieved one by one.
			if (config.isDebugModeOn()) {

				rd = resourceHandler.getResource(null, bundlePath);
			} else {

				for (String prefix : bundlePrefixes) {
					if (bundlePath.startsWith(prefix)) {
						bundlePath = bundlePath.substring(prefix.length());
						break;
					}
				}

				// Prefixes are used only in production mode
				String path = PathNormalizer.removeVariantPrefixFromPath(bundlePath);
				rd = resourceBundleHandler.getResourceBundleReader(path);
				if (liveProcessBundles.contains(path)) {
					rd = processInLive(rd);
				}
			}

			IOUtils.copy(rd, writer);
			writer.flush();
		} catch (IOException e) {
			throw new BundlingProcessException("Unexpected IOException writing bundle[" + bundlePath + "]", e);
		} finally {
			IOUtils.close(rd);
			IOUtils.close(writer);
		}
	}
991536
@Override
   public void writeImport(Definition def, Writer out) throws IOException
   {
      out.write("package " + def.getRaPackage() + ";\n\n");
   }
994925
public static void write(HttpServletResponse response, String text, String contentType) {
		response.setContentType(contentType);
		Writer writer = null;
		try {
			writer = response.getWriter();
			writer.write(text);
			writer.flush();
		} catch (IOException e) {
			throw new UtilException(e);
		} finally {
			IoUtil.close(writer);
		}
	}
1044684
public void write(Bean bean, boolean rootType, Appendable output) throws IOException {
        if (bean == null) {
            throw new NullPointerException("bean");
        }
        this.output = output;
        this.rootBean = bean;
        this.basePackage = (rootType ? bean.getClass().getPackage().getName() + "." : null);
        
        String type = rootBean.getClass().getName();
        writeHeader();
        output.append('<').append(BEAN);
        if (rootType) {
            appendAttribute(output, TYPE, type);
        }
        output.append('>').append(settings.getNewLine());
        writeBean(rootBean, settings.getIndent());
        output.append('<').append('/').append(BEAN).append('>').append(settings.getNewLine());
    }
71354
@Override
    public void writeContent(XMLExtendedStreamWriter writer, Dependency value) throws XMLStreamException {

        if(value != null && this != value) {
            throw new IllegalStateException("Wrong target dependency.");
        }

        writer.writeStartElement(ModuleConfigImpl.MODULE);
        writer.writeAttribute(ModuleConfigImpl.NAME, name);
        if (export) {
            writer.writeAttribute(ModuleConfigImpl.EXPORT, "true");
        }
        writer.writeEndElement();
    }
415264
protected final PrintWriter getPrintWriter( String packageName, String className ) {
        return context.tryCreate( logger, packageName, className );
    }
1339606
public String write(Bean bean, boolean rootType) {
        StringBuilder buf = new StringBuilder(1024);
        try {
            write(bean, rootType, buf);
        } catch (IOException ex) {
            throw new IllegalStateException(ex);
        }
        return buf.toString();
    }