Examples of FileWriterWithEncoding


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

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

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

    @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

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

    protected HtmlPage getRedirectionPage(final WebClient webClient, final Client<?, ?> client,
            final MockWebContext context) throws Exception {
        // force immediate redirection for tests
        client.redirect(context, true, false);
        File redirectFile = File.createTempFile("pac4j-saml2", ".html");
        FileWriterWithEncoding writer = new FileWriterWithEncoding(redirectFile, "UTF-8");
        writer.write(context.getResponseContent());
        writer.close();
        logger.debug("redirectPage path : {}", redirectFile.getPath());
        final HtmlPage redirectPage = webClient.getPage(redirectFile.toURI().toURL());
        final HtmlForm form = redirectPage.getForms().get(0);
        final HtmlSubmitInput submit = (HtmlSubmitInput) form.getElementsByAttribute("input", "type", "submit").get(0);
        return submit.click();
View Full Code Here

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

    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

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

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

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

    }

    private static File writeSvgToFile(final Document document,
            final File workingDir) throws IOException {
        final File path = File.createTempFile("north-arrow-", ".svg", workingDir);
        FileWriterWithEncoding fw = null;
        try {
            fw = new FileWriterWithEncoding(path, Charset.forName("UTF-8").newEncoder());
            DOMUtilities.writeDocument(document, fw);
            fw.flush();
        } finally {
            if (fw != null) {
                fw.close();
            }
        }
        return path;
    }
View Full Code Here

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

    @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

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

     *             written.
     */
    protected void processTemplate( String templateName, File targetDirectory )
        throws MojoFailureException
    {
        FileWriterWithEncoding pageWriter = null;
        try
        {
            pageWriter =
                new FileWriterWithEncoding( new File( targetDirectory.getCanonicalPath() + File.separator
                    + templateName ), Charset.forName( outputEncoding ) );
            velocityEngine.mergeTemplate( "/templates/source-view/" + templateName + ".vm",
                                          Charset.forName( "UTF-8" ).name(), velocityContext, pageWriter );
        }
        catch ( ResourceNotFoundException e )
        {
            throw new MojoFailureException( "The template '" + templateName + "' could not be found.", e );
        }
        catch ( ParseErrorException e )
        {
            throw new MojoFailureException( "Failed to parse the template '" + templateName + "' .", e );
        }
        catch ( Exception e )
        {
            throw new MojoFailureException( "Failed to load the template '" + templateName + "' .", e );
        }
        finally
        {
            try
            {
                pageWriter.close();
            }
            catch ( IOException e )
            {
                throw new MojoFailureException( "Failed to write the template '" + templateName + "' .", e );
            }
View Full Code Here

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

    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
Copyright © 2018 www.massapi.com. 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.