@Override
    public Writer openWriter() {
        return new Writer() {
            @Override
            public Writer append(CharSequence csq) throws IOException {
                contents.append(csq);
                return this;
            }

            @Override
            public void close() {
            }

            @Override
            public void flush() {
            }

            @Override
            public void write(char[] cbuf, int off, int len) throws IOException {
                contents.append(cbuf, off, len);
            }
        };
    }
MemSourceFileObject defines a in-memory Java source file object

@author tiwe
querydsl-codegen-utils/src/main/java/com/querydsl/codegen/utils/MemSourceFileObject.java