@Override
    public OutputStream openOutputStream() throws IOException {
        if (baos == null) {
            baos = new ByteArrayOutputStream();
        }
        return baos;
    }
MemJavaFileObject defines an in memory compiled Java file

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