protected void writeCode(final String packageName, final String className, final StringBuffer code) {
        try {
            JavaFileObject jfo = filer.createSourceFile(packageName + "." + className);
            Writer w = jfo.openWriter();
            BufferedWriter bw = new BufferedWriter(w);
            bw.append(code);
            bw.close();
            w.close();
        } catch (IOException e) {
            throw new GenerationException(String.format("Error writing code for %s.%s: %s",
                    packageName, className, e.getMessage()));
        }
    }
protected void writeCode ( final String packageName , final String className , final StringBuffer code ) { try { JavaFileObject jfo = filer . createSourceFile ( packageName + "." + className ) ; Writer w = jfo . openWriter ( ) ; BufferedWriter bw = new BufferedWriter ( w ) ; bw . append ( code ) ; bw . close ( ) ; w . close ( ) ; } catch ( IOException e ) { throw new GenerationException ( String . format ( "Error writing code for %s.%s: %s" , packageName , className , e . getMessage ( ) ) ) ; } }
Writes the specified source code and wraps any {@code IOException} as {@link GenerationException}.

@param packageName the package name
@param className   the class name
@param code        the source code
@throws GenerationException if an {@code IOException occurs}