@Override
    public Writer createFile(ProcessingEnvironment processingEnvironment, String classname, Collection<? extends Element> elements) throws IOException {
        return processingEnvironment.getFiler().createSourceFile(classname, elements.toArray(new Element[0])).openWriter();
    }
creates files with {@link javax.annotation.processing.Filer}.

@author f43nd1r
querydsl-codegen/src/main/java/com/querydsl/codegen/DefaultFiler.java