code: public static WriteStreamOld openWrite(CharBuffer cb)
    {
      com.caucho.v5.vfs.VfsStringWriter s = new com.caucho.v5.vfs.VfsStringWriter(cb);
      WriteStreamOld os = new WriteStreamOld(s);
      
      try {
        os.setEncoding("utf-8");
      } catch (Exception e) {
      }
  
      return os;
    }
docs: Creates a write stream to a CharBuffer.  This is the standard way
  to write to a string.