C++ ostream to Java Writer integration