List of usage examples for java.io Writer write
public void write(String str) throws IOException
From source file:framework.GroovyTemplateEngine.java
private static void addChar(Writer writer, int s, int ch) throws IOException { if (ch == '\'' && s != 3 && s != 6) { writer.append("\\'"); } else if (ch == '\\') { writer.append("\\\\"); } else if (ch == '$') { writer.append("\\$"); } else {//from w ww . ja v a 2s.c o m writer.write(ch); } }
From source file:com.cloudhopper.sxmp.SxmpWriter.java
static private void writeOperationStartTag(Writer out, Operation.Type type) throws IOException { if (type == null) { throw new NullPointerException("Operation type cannot be null"); }//from w w w . j a va2s . c o m out.write("<operation type=\"" + type.getValue() + "\">\n"); }
From source file:de.ingrid.portal.global.UtilsFileHelper.java
/** * Write String into file/*from w w w . j a va 2 s. c o m*/ * * @param path * @param content * @throws IOException */ public static void writeContentIntoFile(String path, String content) throws IOException { if (path != null) { File file = new File(path); if (file.length() < 1) { if (content != null) { Writer writer = null; writer = new FileWriter(path); writer.write(content); writer.close(); } else { if (log.isErrorEnabled()) { log.error("Content is null!"); } } } } }
From source file:com.deque.axe.AXE.java
/** * Writes a raw object out to a JSON file with the specified name. * @param name Desired filename, sans extension * @param output Object to write. Most useful if you pass in either the Builder.analyze() response or the * violations array it contains. */// w w w . j a v a2 s . c o m public static void writeResults(final String name, final Object output) { Writer writer = null; try { writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(name + ".json"), "utf-8")); writer.write(output.toString()); } catch (IOException ignored) { } finally { try { writer.close(); } catch (Exception ignored) { } } }
From source file:com.cloudhopper.sxmp.SxmpWriter.java
static private void writeXmlHeader(Writer out, Operation operation) throws IOException { // v1.1 needs to be UTF-8; v1.0 was unspecified if (operation.getVersion().equals(SxmpParser.VERSION_1_0)) out.write("<?xml version=\"1.0\"?>\n"); else//w w w .j a va 2 s . c o m out.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"); }
From source file:com.sun.faban.harness.webclient.Deployer.java
private static void writeHeader(HttpServletRequest request, Writer w) throws IOException { w.write("<!DOCTYPE html\n"); w.write(" PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n"); w.write(" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-" + "transitional.dtd\">\n"); w.write("<html>\n"); w.write(" <head>\n"); w.write(" <title>" + Config.HARNESS_NAME + " Benchmark/Service Deployment</title>\n"); w.write("<link rel=\"icon\" type=\"image/gif\" href=\"" + request.getContextPath() + "/img/faban.gif\">"); w.write("<link rel=\"stylesheet\" type=\"text/css\" href=\"/css/style.css\" />"); w.write(" </head>\n"); w.write(" <body>\n"); w.write(" <table BORDER=\"0\" CELLSPACING=\"0\" CELLPADDING=\"0\" WIDTH=\"100%\" >\n"); w.write(" <tr class=\"gradient\">\n"); w.write(" <td align=\"left\" width=\"25%\" style=\"color:white; font-size:10px\">\n"); w.write(" <img src=\"img/faban_large.png\" height=\"50\" width=\"58\"/><br></td>\n"); w.write(" <td align=\"center\" width=\"50%\" style=\"color:white; font-size:10px\">\n"); w.write(" <b>Benchmark/Service Deployment</b></td>\n"); w.write(" <td align=\"right\" valign=\"bottom\" width=25% style=\"color:white\">"); w.write(Config.HARNESS_NAME + " " + Config.HARNESS_VERSION + " </td>\n"); w.write(" </tr>\n"); w.write(" </table>"); w.write(" <br><center><b>"); }
From source file:jp.crudefox.mymon.picturetool.api.Caker.java
private static void appendParam(Writer writer, String name, Object value, boolean first) throws IOException { // append value if (!first) { writer.write("&"); }/*w ww . ja v a2 s .c om*/ writer.write(CharEscapers.escapeUri(name)); if (value != null) { String stringValue = CharEscapers.escapeUri(value.toString()); if (stringValue.length() != 0) { writer.write("="); writer.write(stringValue); } } }
From source file:com.sun.faces.generate.AbstractGenerator.java
/** * <p>Render the specified description text to the specified writer, * prefixing each line by 'indent' spaces, an asterisk ("*"), and another * space. This rendering is appropriate for the creation of * JavaDoc comments on classes, variables, and methods.</p> * * @param desc Description text to be rendered * @param writer Writer to which output should be sent * @param indent Number of leading space for each line *//*from w ww . j av a 2 s . c o m*/ protected static void description(String desc, Writer writer, int indent) throws Exception { for (int i = 0; i < indent; i++) { writer.write(" "); } writer.write("* "); int n = desc.length(); for (int i = 0; i < n; i++) { char ch = desc.charAt(i); if (ch == '\r') { continue; } writer.write(ch); if (ch == '\n') { for (int j = 0; j < indent; j++) { writer.write(" "); } writer.write("* "); } } writer.write("\n"); }
From source file:Main.java
/** * Dumps XML attributes out to the specified writer * * @param out the writer/*from ww w . j a va2s . c o m*/ * @param attributes the attributes * @throws IOException */ public static void dumpAttributes(Writer out, Map attributes) throws IOException { if ((attributes == null) || (attributes.isEmpty())) { return; } Iterator it = attributes.entrySet().iterator(); Map.Entry me; String value; while (it.hasNext()) { me = (Map.Entry) it.next(); value = (String) me.getValue(); if (value != null) { out.write(' '); out.write((String) me.getKey()); out.write("=\""); out.write(value); out.write('"'); } } }
From source file:com.gm.machine.util.CommonUtils.java
private synchronized static void writeHtml(String htmlFileName, String content, String encoding) throws Exception { Writer fw = null; try {//from w w w. ja v a 2 s . c om fw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(htmlFileName), encoding)); fw.write(content); fw.flush(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } finally { // ? if (fw != null) { fw.close(); } } }