java.io.Writer#append ( )源码实例Demo

下面列出了java.io.Writer#append ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: gemfirexd-oss   文件: PluckStacks.java
public void writeTo(Writer w) throws IOException {
  if (DEBUG) {
    w.append("stack.name='"+getThreadName()+"' runnable="+this.runnable + " lines=" + lines.size());
    w.append("\n");
  }
  boolean first = true;
  for (String line: lines) {
    w.append(line);
    w.append("\n");
    if (first) {
      first = false;
      if (breadcrumbs != null) {
        for (String bline: breadcrumbs) {
          w.append(bline).append("\n");
        }
      }
    }
  }
}
 
源代码2 项目: trader   文件: DisplayMessage.java
/**
 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
 */
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
	String encodedMessage = request.getParameter("message");
	String message = URLDecoder.decode(encodedMessage, "UTF-8");
	Writer writer = response.getWriter();
	writer.append("<!DOCTYPE html>");
	writer.append("<html>");
	writer.append("  <head>");
	writer.append("    <title>Stock Trader</title>");
	writer.append("    <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />");
	writer.append("  </head>");
	writer.append("  <body>");
	writer.append("    <img src=\"header.jpg\" width=\"534\" height=\"200\"/>");
	writer.append("    <p/>");
	writer.append("    "+message);
	writer.append("    <p/>");
	writer.append("    <form method=\"post\"/>");
	writer.append("      <input type=\"submit\" name=\"submit\" value=\"OK\" style=\"font-family: sans-serif; font-size: 16px;\" />");
	writer.append("    </form>");
	writer.append("    <br/>");
	writer.append("    <a href=\"https://github.com/IBMStockTrader\">");
	writer.append("      <img src=\"footer.jpg\"/>");
	writer.append("    </a>");
	writer.append("  </body>");
	writer.append("</html>");
}
 
源代码3 项目: javaide   文件: FilterDataPersistence.java
public void persist(List<FileSupplier> fileSuppliers, Writer writer) throws IOException {
    Gson gson = new Gson();
    ImmutableList.Builder<Record> records = ImmutableList.builder();
    for (FileSupplier fileSupplier : fileSuppliers) {
        if (fileSupplier instanceof SplitFileSupplier) {
            records.add(new Record(
                    ((SplitFileSupplier) fileSupplier).getFilterData().getFilterType(),
                    ((SplitFileSupplier) fileSupplier).getFilterData().getIdentifier(),
                    fileSupplier.get().getName()));
        }
    }
    String recordsAsString = gson.toJson(records.build());
    try {
        writer.append(recordsAsString);
    } finally {
        writer.close();
    }
}
 
源代码4 项目: weasis-dicom-tools   文件: Series.java
@Override
public void toXml(Writer result) throws IOException {
    if (seriesInstanceUID != null) {
        result.append("\n<");
        result.append(Xml.Level.SERIES.getTagName());
        result.append(" ");
        Xml.addXmlAttribute(Tag.SeriesInstanceUID, seriesInstanceUID, result);
        Xml.addXmlAttribute(Tag.SeriesDescription, seriesDescription, result);
        Xml.addXmlAttribute(Tag.SeriesNumber, seriesNumber, result);
        Xml.addXmlAttribute(Tag.Modality, modality, result);
        Xml.addXmlAttribute("DirectDownloadThumbnail", thumbnail, result);
        Xml.addXmlAttribute("WadoTransferSyntaxUID", wadoTransferSyntaxUID, result);
        Xml.addXmlAttribute("WadoCompressionRate",
            wadoCompression < 1 ? null : Integer.toString(wadoCompression), result);
        result.append(">");

        List<SopInstance> list = new ArrayList<>(sopInstanceMap.values());
        Collections.sort(list);
        for (SopInstance s : list) {
            s.toXml(result);
        }
        result.append("\n</");
        result.append(Xml.Level.SERIES.getTagName());
        result.append(">");
    }
}
 
源代码5 项目: orion.server   文件: FileHandlerV1.java
/**
 * Appends metadata to a Writer. Does not flush the Writer.
 */
protected void appendGetMetadata(HttpServletRequest request, HttpServletResponse response, Writer responseWriter, IFileStore file) throws IOException,
		NoSuchAlgorithmException, JSONException, CoreException {
	JSONObject metadata = getMetadata(request, file);
	response.setHeader(ProtocolConstants.KEY_ETAG, metadata.getString(ProtocolConstants.KEY_ETAG));
	response.setHeader("Cache-Control", "no-cache"); //$NON-NLS-1$ //$NON-NLS-2$
	OrionServlet.decorateResponse(request, metadata, JsonURIUnqualificationStrategy.ALL);
	responseWriter.append(metadata.toString());
}
 
源代码6 项目: sumk   文件: HttpMonitor.java
private void outputActs(HttpServletRequest req, Writer writer) throws IOException {
	if (!"1".equals(req.getParameter("acts"))) {
		return;
	}
	writer.append(Arrays.toString(HttpActions.acts()));
	writer.append(TYPE_SPLIT);
}
 
源代码7 项目: gama   文件: TestProcessor.java
public void writeTests(final ProcessorContext context, final Writer sb) throws IOException {
	sb.append("experiment ").append(toJavaString("Tests for " + context.currentPlugin)).append(" type: test {");
	for (final StringBuilder tests : serializedElements.values()) {
		sb.append(ln);
		sb.append(tests);
	}
	sb.append(ln).append('}');
	namesAlreadyUsed.clear();
}
 
源代码8 项目: sundrio   文件: FieldDirective.java
private void writeField(Writer writer, Property field, String block) throws IOException {
    if (field != null) {
        writer.append(field.toString());

        if (field.getAttribute(INIT) != null) {
            writer.append(" = ").append(getDefaultValue(field));
        }
    }
    writer.append(";");
}
 
源代码9 项目: Elasticsearch   文件: Joda.java
@Override
public void printTo(Writer out, long instant, Chronology chrono, int displayOffset, DateTimeZone displayZone, Locale locale) throws IOException {
    if (hasMilliSecondPrecision) {
        out.write(String.valueOf(instant));
    } else {
        out.append(String.valueOf(instant / 1000));
    }
}
 
源代码10 项目: anno4j   文件: DiskBlobStoreTest.java
public void testAbandon() throws Exception {
	BlobVersion trx1 = store.newVersion("urn:test:trx1");
	Writer file = trx1.open("urn:test:file").openWriter();
	file.append("test1");
	trx1.commit();
	assertEquals(Arrays.asList(), Arrays.asList(store.getRecentModifications()));
	store.erase();
	assertEmpty(dir);
}
 
源代码11 项目: netbeans   文件: HTMLDialogProcessor.java
private void generateTechIds(Writer w, String[] techIds) throws IOException {
    if (techIds.length == 0) {
        return;
    }
    w.append("addTechIds(");
    String sep = "";
    for (String id : techIds) {
        w.append(sep);
        w.append('"');
        w.append(id);
        w.append('"');
        sep = ", ";
    }
    w.append(").\n");
}
 
源代码12 项目: super-cloudops   文件: TextNode.java
public void writeAll(Writer writer, IHTMLFilter htmlFilter, boolean convertIntoValidXML, boolean filterText)
		throws IOException {

	if (filterText) {
		return;
	}

	if (htmlFilter != null) {
		String newText = htmlFilter.modifyNodeText(tagName, getText());
		writer.append(newText);
	} else {
		writer.append(getText());
	}
}
 
源代码13 项目: javascad   文件: ModelToFile.java
/**
 * Saves the models to the file.
 * @param context the color context to be used for the generation
 * @throws IOException if any IO error happens during opening, writing or closing the file
 */
public void saveToFile(IColorGenerationContext context) throws IOException {
	Writer writer = new FileWriter(file);
	try {
		for (IModel model : models) {
			writer.append(model.toScad(context).getScad());
		}
	}
	finally {
		writer.close();
	}
}
 
源代码14 项目: artio   文件: AcceptorGenerator.java
private void generateAcceptorClass(final Writer acceptorOutput) throws IOException
{
    acceptorOutput.append(fileHeader(packageName));
    acceptorOutput.append(
        "\n" +
        "public interface " + DICTIONARY_ACCEPTOR + "\n" +
        "{\n"
    );
}
 
源代码15 项目: jfuzzylite   文件: RScriptExporter.java
/**
 Writes the header of the R script (e.g., import libraries)

 @param writer is the output where the header will be written to
 @param engine is the engine to export
 @throws IOException if any error occurs upon writing on the writer

 */
protected void writeScriptHeader(Writer writer, Engine engine) throws IOException {
    writer.append("#Code automatically generated with " + FuzzyLite.LIBRARY + ".\n\n");
    writer.append("library(ggplot2);\n");
    writer.append("\n");
    writer.append("engine.name = \"" + engine.getName() + "\"\n");
    if (!Op.isEmpty(engine.getDescription())) {
        writer.append(String.format(
                "engine.description = \"%s\"\n", engine.getDescription()));
    }
    writer.append("engine.fll = \"" + new FllExporter().toString(engine) + "\"\n\n");
}
 
源代码16 项目: summerframework   文件: CustomJsonLayout.java
@Override
public void toSerializable(final LogEvent event, final Writer writer) throws IOException {
    if (complete && eventCount > 0) {
        writer.append(", ");
    }
    super.toSerializable(event, writer);
}
 
源代码17 项目: ipst   文件: EventsHelper.java
public static void    addLine(Writer writer, String line) {
    try {
        writer.append(line);
        writer.append(StaticData.NEW_LINE);
    } catch (IOException e) {
        LOGGER.error(e.getMessage(), e);
    }
}
 
源代码18 项目: shipkit   文件: DefaultReleaseNotesData.java
@Override
public void toJson(Writer writable) throws IOException {
    writable.append(toJson());
}
 
源代码19 项目: groovy   文件: YamlBuilder.java
/**
 * The YAML builder implements the <code>Writable</code> interface,
 * so that you can have the builder serialize itself the YAML payload to a writer.
 * <p>
 * Example:
 * <pre><code class="groovyTestCase">
 * def yaml = new groovy.yaml.YamlBuilder()
 * yaml { temperature 37 }
 *
 * def out = new StringWriter()
 * out {@code <<} yaml
 *
 * assert out.toString() == '''---
 * temperature: 37
 * '''
 * </code></pre>
 *
 * @param out a writer on which to serialize the YAML payload
 * @return the writer
 */
@Override
public Writer writeTo(Writer out) throws IOException {
    return out.append(toString());
}
 
源代码20 项目: jfuzzylite   文件: RScriptExporter.java
/**
 Writes an R script plotting multiple surfaces based on a data frame
 generated with the given number of values and scope for the two input
 variables on the output variables.

 @param engine is the engine to export
 @param writer is the output where the engine will be written to
 @param a is the first input variable
 @param b is the second input variable
 @param reader is an input stream of data whose lines contain
 space-separated input values
 @param outputVariables are the output variables to create the surface for
 @throws IOException if any error occurs upon writing on the writer

 */
public void writeScriptExportingDataFrame(Engine engine, Writer writer,
        InputVariable a, InputVariable b, Reader reader,
        List<OutputVariable> outputVariables) throws IOException {
    writeScriptHeader(writer, engine);

    writer.append("engine.fldFile = \"");
    new FldExporter().write(engine, writer, reader);
    writer.append("\"\n\n");

    writer.append("engine.df = read.delim(textConnection(engine.fld), header=TRUE, "
            + "sep=\" \", strip.white=TRUE)\n\n");

    writeScriptPlots(writer, a, b, outputVariables);
}