Example usage for java.io PrintWriter println

List of usage examples for java.io PrintWriter println

Introduction

In this page you can find the example usage for java.io PrintWriter println.

Prototype

public void println(Object x) 

Source Link

Document

Prints an Object and then terminates the line.

Usage

From source file:org.apache.lens.regression.util.Util.java

public static void writeFile(String fileName, String str) {
    try {//from  w ww  . ja  v a 2s .  c o  m
        PrintWriter out = new PrintWriter(fileName, "UTF-8");
        out.println(str);
        out.close();
    } catch (IOException e) {
        log.info("File Exception : ", e);
    }
}

From source file:com.zimbra.common.util.TemplateCompiler.java

private static void printStringLine(PrintWriter out, String... ss) {
    out.print("\tbuffer[_i++] = \"");
    for (String s : ss) {
        printEscaped(out, s);//from w  w w. jav  a 2 s  .  c  o  m
    }
    out.println("\";");
}

From source file:at.tuwien.ifs.somtoolbox.data.InputDataWriter.java

public static void writeHeaderToFile(PrintWriter writer, int numVectors, int dim) throws IOException {
    writer.println("$TYPE vec");
    writer.println("$XDIM " + numVectors);
    writer.println("$YDIM 1");
    writer.println("$VEC_DIM " + dim);
}

From source file:doclet.RefGuideDoclet.java

public static void writeTOC(PrintWriter pw, List<Heading> package_list) {
    pw.println("<div class=\"span-3\">");
    pw.println("<div class=\"api-toc\" id=\"toc\">");

    for (Heading heading : package_list) {
        String id = heading.getId();
        pw.println("<div class=\"api-toc-domain-container\" id=\"" + id + "_toc\">");
        pw.println("   <div class=\"api-toc-domain-name\"><a href=\"#" + id + "\">" + id + "</a></div>");

        List<Heading> children = heading.getChildren();
        System.out.println("Heading has: " + children.size());
        for (Heading h2 : children) {
            pw.println("   <div class=\"api-toc-endpoint\" id=\"" + h2.getId() + "_toc\"><a href=\"#"
                    + h2.getId() + "\">" + h2.getText() + "</a></div>");
        }// w  ww  .jav a 2s  . c  o m
        pw.println("</div>");
    }
    pw.println("</div></div>");
}

From source file:org.apache.asterix.api.http.server.ResultUtil.java

public static void webUIErrorHandler(PrintWriter out, Exception e) {
    String errorTemplate = readTemplateFile("/webui/errortemplate.html", "%s\n%s\n%s");

    String errorOutput = String.format(errorTemplate, extractErrorMessage(e), extractErrorSummary(e),
            extractFullStackTrace(e));//from   w  w w .  ja  va2  s  .  co  m
    out.println(errorOutput);
}

From source file:gov.nih.nci.caarray.application.translation.geosoft.GeoSoftFileWriterUtil.java

private static void writeExperimentDesignTypes(Experiment experiment, String desc, PrintWriter out) {
    out.print("!Series_overall_design=");
    if (experiment.getExperimentDesignTypes().isEmpty()) {
        out.println(desc);
    } else {/*  ww  w  .  j  a v a 2  s . c o m*/
        String semi = "\"";
        for (final Term edt : experiment.getExperimentDesignTypes()) {
            out.print(semi);
            semi = "\"; \"";
            out.print(edt.getValue());
            out.print(" (");
            out.print(edt.getSource().getName());
            out.print(')');
        }
        out.println('"');
    }
}

From source file:doclet.RefGuideDoclet.java

private static void writePostamble(PrintWriter pw) {
    String txt = "</body>\n" + "</html>";

    pw.println(txt);
}

From source file:net.erdfelt.android.sdkfido.project.FilteredFileUtil.java

public static void copyWithExpansion(String resourceId, File destFile, Map<String, String> props) {
    URL url = FilteredFileUtil.class.getResource(resourceId);
    if (url == null) {
        LOG.log(Level.WARNING, "Unable to find resourceID: " + resourceId);
        return;//  w w w . j ava 2  s  .com
    }

    InputStream in = null;
    InputStreamReader reader = null;
    BufferedReader buf = null;
    FileWriter writer = null;
    PrintWriter out = null;
    try {
        in = url.openStream();
        reader = new InputStreamReader(in);
        buf = new BufferedReader(reader);
        writer = new FileWriter(destFile);
        out = new PrintWriter(writer);

        PropertyExpander expander = new PropertyExpander(props);
        String line;

        while ((line = buf.readLine()) != null) {
            out.println(expander.expand(line));
        }
    } catch (IOException e) {
        LOG.log(Level.WARNING, "Unable to open input stream for url: " + url, e);
    } finally {
        IOUtils.closeQuietly(out);
        IOUtils.closeQuietly(writer);
        IOUtils.closeQuietly(buf);
        IOUtils.closeQuietly(reader);
        IOUtils.closeQuietly(in);
    }
}

From source file:net.erdfelt.android.sdkfido.project.FilteredFileUtil.java

public static String loadExpandedAsString(String resourceId, Map<String, String> props)
        throws OutputProjectException {
    LOG.log(Level.INFO, "Loading resource: " + resourceId);
    if (StringUtils.isBlank(resourceId)) {
        throw new IllegalArgumentException("resourceId cannot be blank");
    }/*from w  w  w. j a  v a 2s.c o m*/
    URL url = FilteredFileUtil.class.getResource(resourceId);
    if (url == null) {
        throw new OutputProjectException("Unable to find resourceID: " + resourceId);
    }

    InputStream in = null;
    InputStreamReader reader = null;
    BufferedReader buf = null;
    StringWriter writer = null;
    PrintWriter out = null;
    try {
        in = url.openStream();
        reader = new InputStreamReader(in);
        buf = new BufferedReader(reader);
        writer = new StringWriter();
        out = new PrintWriter(writer);

        PropertyExpander expander = new PropertyExpander(props);
        String line;

        while ((line = buf.readLine()) != null) {
            out.println(expander.expand(line));
        }

        out.flush();
        writer.flush();
        return writer.toString();
    } catch (IOException e) {
        throw new OutputProjectException("Unable to open input stream for url: " + url, e);
    } finally {
        IOUtils.closeQuietly(out);
        IOUtils.closeQuietly(writer);
        IOUtils.closeQuietly(buf);
        IOUtils.closeQuietly(reader);
        IOUtils.closeQuietly(in);
    }
}

From source file:gov.nih.nci.caarray.application.translation.geosoft.GeoSoftFileWriterUtil.java

private static void writeData(Hybridization h, PrintWriter out) {
    for (final RawArrayData rad : h.getRawDataCollection()) {
        out.print("!Sample_supplementary_file=");
        out.println(rad.getDataFile().getName());
    }//from   ww  w. j a v  a2s  . co  m
    for (final DerivedArrayData dad : h.getDerivedDataCollection()) {
        if (GeoSoftExporterBean.AFFYMETRIX_CHP_TYPE_NAME.equals(dad.getDataFile().getFileType().getName())) {
            out.print("!Sample_table=");
            out.println(dad.getDataFile().getName());
        } else {
            out.print("!Sample_supplementary_file=");
            out.println(dad.getDataFile().getName());
        }
    }
}