Package javax.tools

Examples of javax.tools.JavaFileObject.openWriter()


            try {
                final Filer filer = processingEnv.getFiler();
                final JavaFileObject file = filer.createSourceFile(type.getName().getQualified());

                try (Writer writer = file.openWriter()) {
                    mustache.execute(writer, type).flush();
                }
            } catch (IOException e) {
                throw new IllegalArgumentException(e);
            }
View Full Code Here


            }
        }
        JavaFileObject suite = processingEnv.getFiler()
                .createSourceFile("ch.powerunit.suite.Suites",
                        elements.toArray(new Element[] {}));
        try (PrintWriter w = new PrintWriter(suite.openWriter());) {
            w.println("package ch.powerunit.suite;");
            w.println();
            w.println("@javax.annotation.Generated(\"Test suites for powerunit\")");
            w.println("public final class Suites {");
            w.println();
View Full Code Here

                 null);
        if (inputFiles.contains(outFile)) {
            log.error(cdef.pos(), "source.cant.overwrite.input.file", outFile);
            return null;
        } else {
            BufferedWriter out = new BufferedWriter(outFile.openWriter());
            try {
                new Pretty(out, true).printUnit(env.toplevel, cdef);
                if (verbose)
                    printVerbose("wrote.file", outFile);
            } finally {
View Full Code Here

      packageAsyncName = qualifiedAsyncName.substring(0,lastDot);
    }
    JavaFileObject javaFile = null;
    try {
      javaFile = filer.createSourceFile(qualifiedAsyncName, (Element[]) null);
      Writer writer = javaFile.openWriter();
      PrintWriter pw = new PrintWriter(writer);
      JavaFormatter formatter = new JavaFormatter(pw);
      if (packageAsyncName != null) {
        formatter.printPackage(packageAsyncName);
        pw.println();
View Full Code Here

    private void writeCode( final String packageName,
                            final String className,
                            final StringBuffer code ) {
        try {
            JavaFileObject jfo = processingEnv.getFiler().createSourceFile( packageName + "." + className );
            Writer w = jfo.openWriter();
            BufferedWriter bw = new BufferedWriter( w );
            bw.append( code );
            bw.close();
            w.close();
        } catch ( IOException ioe ) {
View Full Code Here

    private void writeCode(final String packageName,
                           final String className,
                           final StringBuffer code) {
        try {
            JavaFileObject jfo = processingEnv.getFiler().createSourceFile( packageName + "." + className );
            Writer w = jfo.openWriter();
            BufferedWriter bw = new BufferedWriter( w );
            bw.append( code );
            bw.close();
            w.close();
        } catch ( IOException ioe ) {
View Full Code Here

    private void writeCode(final String packageName,
                           final String className,
                           final StringBuffer code) {
        try {
            JavaFileObject jfo = processingEnv.getFiler().createSourceFile( packageName + "." + className );
            Writer w = jfo.openWriter();
            BufferedWriter bw = new BufferedWriter( w );
            bw.append( code );
            bw.close();
            w.close();
        } catch ( IOException ioe ) {
View Full Code Here

    private void writeCode( final String packageName,
                            final String className,
                            final StringBuffer code ) {
        try {
            JavaFileObject jfo = processingEnv.getFiler().createSourceFile( packageName + "." + className );
            Writer w = jfo.openWriter();
            BufferedWriter bw = new BufferedWriter( w );
            bw.append( code );
            bw.close();
            w.close();
        } catch ( IOException ioe ) {
View Full Code Here

    private void writeCode( final String packageName,
                            final String className,
                            final StringBuffer code ) {
        try {
            JavaFileObject jfo = processingEnv.getFiler().createSourceFile( packageName + "." + className );
            Writer w = jfo.openWriter();
            BufferedWriter bw = new BufferedWriter( w );
            bw.append( code );
            bw.close();
            w.close();
        } catch ( IOException ioe ) {
View Full Code Here

    private void writeCode( final String packageName,
                            final String className,
                            final StringBuffer code ) {
        try {
            JavaFileObject jfo = processingEnv.getFiler().createSourceFile( packageName + "." + className );
            Writer w = jfo.openWriter();
            BufferedWriter bw = new BufferedWriter( w );
            bw.append( code );
            bw.close();
            w.close();
        } catch ( IOException ioe ) {
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.