Package org.apache.commons.io.output

Examples of org.apache.commons.io.output.FileWriterWithEncoding


            DescriptiveStatistics statistics) throws IOException {
     
        File report = getReportFile(resultFileName, ".txt");
    boolean needsPrefix = !report.exists();
      PrintWriter writer = new PrintWriter(
          new FileWriterWithEncoding(report, "UTF-8", true));
      try {
        if (needsPrefix) {
          writer.format("# %-50.50s     min     10%%     50%%     90%%     max%n", resultFileName);
        }
       
View Full Code Here


            String methodName, DescriptiveStatistics statistics) throws IOException {
        File report = getReportFile(resultFileName, ".txt");
 
      boolean needsPrefix = !report.exists();
      PrintWriter writer = new PrintWriter(
          new FileWriterWithEncoding(report, "UTF-8", true));
      try {
        if (needsPrefix) {
          writer.format(
                        "%-40.40s|%-120.120s|%-80.80s|%-40.40s|      DateTime      |  min  |   10%%   |   50%%   |   90%%   |   max%n",
              "Test Suite",
View Full Code Here

          }
          if (!file.exists()) {
            file.createNewFile();
          }
          if ("10007".equals(bean.getObj_type())) {
            FileWriterWithEncoding writer = new FileWriterWithEncoding(file, "UTF-8");
            writer.write(bean.getContent());
            writer.close();
          } else {
            FileOutputStream os = new FileOutputStream(file);
            //TODO use a stream to consume lower memory for large files
            os.write(bean.getBinaryContent());
            os.close();
View Full Code Here

    @BeforeClass
    public static void createSrcFile() throws Exception {
        File tmpdir = FileUtils.getTempDirectory();
        TEST_FILE = new File(tmpdir, "src.test");
        FileWriterWithEncoding out = new FileWriterWithEncoding(TEST_FILE, ASCII);
        try {
            for (int i = 0; i < 500; i++) {
                for (String line: TEXT) {
                    out.write(line);
                    out.write("\r\n");
                }
            }
        } finally {
            out.close();
        }
    }
View Full Code Here

            throws IOException {
        File report = new File("target", test + ".txt");

        boolean needsPrefix = !report.exists();
        PrintWriter writer = new PrintWriter(
                new FileWriterWithEncoding(report, "UTF-8", true));
        try {
            if (needsPrefix) {
                writer.format(
                        "# %-34.34s     min     10%%     50%%     90%%     max%n",
                        test);
View Full Code Here

    @BeforeClass
    public static void createSrcFile() throws Exception {
        File tmpdir = FileUtils.getTempDirectory();
        TEST_FILE = new File(tmpdir, "src.test");
        FileWriterWithEncoding out = new FileWriterWithEncoding(TEST_FILE, ASCII);
        try {
            for (int i = 0; i < 500; i++) {
                for (String line: TEXT) {
                    out.write(line);
                    out.write("\r\n");
                }
            }
        } finally {
            out.close();
        }
    }
View Full Code Here

      testObj.setType(objType);
      list.put("0002", testObj);
    }
    String out = xStream.toXML(list);
    System.out.println(out);
    xStream.toXML(list, new FileWriterWithEncoding(
        new File("testconf.xml"), "utf-8"));

    Map<String, TestObj> list2 = (Map<String, TestObj>) xStream
        .fromXML(new File("testconf.xml"));
    for (Map.Entry<String, TestObj> TestObj : list2.entrySet()) {
View Full Code Here

        optionMap.put(option.getName(), option);
      }
      // 保存到xml里面.
      File confFile = new File(FreemakerTemplateEngine.WEBAPP_PATH
          + OPTION_CONF_FILE);
      xStream.toXML(optionMap, new FileWriterWithEncoding(confFile,
          "utf-8"));
      // baseDao.save(option);
      // 更新配置文件.
      updateGlobalConf();
    } catch (Exception e) {
View Full Code Here

            throws IOException {
        File report = new File("target", test + ".txt");

        boolean needsPrefix = !report.exists();
        PrintWriter writer = new PrintWriter(
                new FileWriterWithEncoding(report, "UTF-8", true));
        try {
            if (needsPrefix) {
                writer.format(
                        "# %-34.34s     min     10%%     50%%     90%%     max%n",
                        test);
View Full Code Here

    private static void writeReport(String test, String name, String microKernel,
            DescriptiveStatistics statistics) throws IOException {
        File report = new File("target", test + "-" + microKernel + ".txt");

        boolean needsPrefix = !report.exists();
        PrintWriter writer = new PrintWriter(new FileWriterWithEncoding(report,
                "UTF-8", true));
        try {
            if (needsPrefix) {
                writer.format(
                        "# %-34.34s     min     10%%     50%%     90%%     max%n",
View Full Code Here

TOP

Related Classes of org.apache.commons.io.output.FileWriterWithEncoding

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.