diff --git a/FileIO/GMSHInterface.cpp b/FileIO/GMSHInterface.cpp
index 3cdc1795caa8cd9918b8d35430077cc57c4a73f4..cd3b6733a79da1b9c8c075bd8665bed6ed3f08cf 100644
--- a/FileIO/GMSHInterface.cpp
+++ b/FileIO/GMSHInterface.cpp
@@ -255,15 +255,15 @@ void GMSHInterface::readNodeIDs(std::ifstream &in,
 	}
 }
 
-bool GMSHInterface::write(std::ostream& out)
+bool GMSHInterface::write()
 {
-	out << "// GMSH input file created by OpenGeoSys " << OGS_VERSION_AND_PERSONS;
+	_out << "// GMSH input file created by OpenGeoSys " << OGS_VERSION_AND_PERSONS;
 #ifdef BUILD_TIMESTAMP
-	out << " built on " << BUILD_TIMESTAMP;
+	_out << " built on " << BUILD_TIMESTAMP;
 #endif
-	out << "\n\n";
+	_out << "\n\n";
 
-	writeGMSHInputFile(out);
+	writeGMSHInputFile(_out);
 	return true;
 }
 
diff --git a/FileIO/GMSHInterface.h b/FileIO/GMSHInterface.h
index 9258b5ecc9975ac6cacf4be1eb633759291db2b9..9af1184d37cf274c370a71dc347d24fc60e7cacf 100644
--- a/FileIO/GMSHInterface.h
+++ b/FileIO/GMSHInterface.h
@@ -84,7 +84,7 @@ public:
 	static MeshLib::Mesh* readGMSHMesh (std::string const& fname);
 
 protected:
-	bool write(std::ostream& stream);
+	bool write();
 
 private:
 	/**
diff --git a/FileIO/Legacy/MeshIO.cpp b/FileIO/Legacy/MeshIO.cpp
index 3b99a3527144a2ea83ac61715d7092d91d2050b5..8af4126af9ef22a3631f975c72a42d6484fab56a 100644
--- a/FileIO/Legacy/MeshIO.cpp
+++ b/FileIO/Legacy/MeshIO.cpp
@@ -228,30 +228,30 @@ MeshLib::Element* MeshIO::readElement(const std::string& line,
 	return elem;
 }
 
-bool MeshIO::write(std::ostream &out)
+bool MeshIO::write()
 {
 	if(!_mesh) {
 		WARN("MeshIO::write(): Cannot write: no mesh object specified.");
 		return false;
 	}
 
-	out << "#FEM_MSH\n"
+	_out << "#FEM_MSH\n"
 		<< "$PCS_TYPE\n"
 		<< "  NO_PCS\n"
 		<< "$NODES\n"
 		<< "  ";
 	const size_t n_nodes(_mesh->getNNodes());
-	out << n_nodes << "\n";
+	_out << n_nodes << "\n";
 	for (size_t i(0); i < n_nodes; ++i) {
-		out << i << " " << *(_mesh->getNode(i)) << "\n";
+		_out << i << " " << *(_mesh->getNode(i)) << "\n";
 	}
 
-	out << "$ELEMENTS\n"
+	_out << "$ELEMENTS\n"
 		<< "  ";
 
-	writeElements(_mesh->getElements(), out);
+	writeElements(_mesh->getElements(), _out);
 
-	out << " $LAYER\n"
+	_out << " $LAYER\n"
 		<< "  0\n"
 		<< "#STOP\n";
 
diff --git a/FileIO/Legacy/MeshIO.h b/FileIO/Legacy/MeshIO.h
index b22de8989c24ea5f2a2eaeeeb47f01b73e170858..7901396dfec3d78b7d6bf068fc4fa2f7798bdded 100644
--- a/FileIO/Legacy/MeshIO.h
+++ b/FileIO/Legacy/MeshIO.h
@@ -53,7 +53,7 @@ public:
 
 protected:
 	/// Write mesh to stream.
-	bool write(std::ostream &out);
+	bool write();
 
 private:
 	void writeElements(std::vector<MeshLib::Element*> const& ele_vec, std::ostream &out) const;
diff --git a/FileIO/Writer.cpp b/FileIO/Writer.cpp
index 23feb62a8929eb80f4e8fe73539221f0289008a3..a64505794d191e3f09b86cfeb3ef6fc91b1d0e66 100644
--- a/FileIO/Writer.cpp
+++ b/FileIO/Writer.cpp
@@ -32,7 +32,7 @@ std::string Writer::writeToString()
 	_out.str("");
 	_out.clear();
 
-	if (this->write(_out))
+	if (this->write())
 		return _out.str();
 	else
 		return std::string("");
diff --git a/FileIO/Writer.h b/FileIO/Writer.h
index bf5526514bd285d8c11fb739659f00c0bc7acaa1..de30348bb407318eeb96993204e8cc2e2428dda7 100644
--- a/FileIO/Writer.h
+++ b/FileIO/Writer.h
@@ -46,10 +46,10 @@ public:
 	void setFormat(std::ios_base::fmtflags flags);
 
 protected:
-	/// @brief Writes the object to the given stream.
+	/// @brief Writes the object to the internal stream.
 	/// This method must be implemented by a subclass.
 	/// The implementation should return true on success, else false
-	virtual bool write(std::ostream& stream) = 0;
+	virtual bool write() = 0;
 
 	/// @brief The stream to write to.
 	std::stringstream _out;
diff --git a/FileIO/XmlIO/Boost/BoostVtuInterface.cpp b/FileIO/XmlIO/Boost/BoostVtuInterface.cpp
index 815d6956b6f10291b96465b8763d145bb0577f26..ae92488a4cc62410fa99236f76952f33799da5a2 100644
--- a/FileIO/XmlIO/Boost/BoostVtuInterface.cpp
+++ b/FileIO/XmlIO/Boost/BoostVtuInterface.cpp
@@ -395,8 +395,19 @@ const OptionalPtree BoostVtuInterface::findDataArray(std::string const& array_na
 	return OptionalPtree();
 }
 
-void BoostVtuInterface::buildPropertyTree(std::ostream& stream)
+void BoostVtuInterface::setMesh(const MeshLib::Mesh* mesh)
 {
+	if (!mesh)
+	{
+		ERR("BoostVtuInterface::write(): No mesh specified.");
+	}
+	this->_mesh = const_cast<MeshLib::Mesh*>(mesh);
+	buildPropertyTree();
+};
+
+void BoostVtuInterface::buildPropertyTree()
+{
+	_doc.clear();
 	const std::size_t nNodes (_mesh->getNNodes());
 	const std::size_t nElems (_mesh->getNElements());
 	const std::vector<MeshLib::Node*> &nodes (_mesh->getNodes());
@@ -428,7 +439,7 @@ void BoostVtuInterface::buildPropertyTree(std::ostream& stream)
 	celldata_node.put("<xmlattr>.Scalars", "MaterialIDs");
 
 	std::stringstream oss(std::stringstream::out);
-	oss.precision(stream.precision());
+	oss.precision(_out.precision());
 	oss << std::endl << data_array_indent;
 	for (unsigned i = 0; i < nElems; i++)
 		oss << elements[i]->getValue() << " ";
@@ -479,17 +490,14 @@ void BoostVtuInterface::buildPropertyTree(std::ostream& stream)
 	this->addDataArray(cells_node, "types", "UInt8", typestream.str());
 }
 
-bool BoostVtuInterface::write(std::ostream& stream)
+bool BoostVtuInterface::write()
 {
-	if (!_mesh)
-	{
+	if (_doc.empty()) {
 		ERR("BoostVtuInterface::write(): No mesh specified.");
-		return 0;
+		return false;
 	}
-
-	buildPropertyTree(stream);
 	property_tree::xml_writer_settings<char> settings('\t', 1);
-	write_xml(stream, _doc, settings);
+	write_xml(_out, _doc, settings);
 	return true;
 }
 
diff --git a/FileIO/XmlIO/Boost/BoostVtuInterface.h b/FileIO/XmlIO/Boost/BoostVtuInterface.h
index e21c9ca4303d0bdfde3c4900008531056cc07f63..1444ba408cc135e2df83b4280a589f31cf3d9768 100644
--- a/FileIO/XmlIO/Boost/BoostVtuInterface.h
+++ b/FileIO/XmlIO/Boost/BoostVtuInterface.h
@@ -56,14 +56,14 @@ public:
 	void setCompressData(bool flag=true) { _use_compressor = flag; };
 
 	/// Set mesh for writing.
-	void setMesh(const MeshLib::Mesh* mesh) { this->_mesh = const_cast<MeshLib::Mesh*>(mesh); };
+	void setMesh(const MeshLib::Mesh* mesh);
 
 protected:
-	void buildPropertyTree(std::ostream& stream);
+	void buildPropertyTree();
 	/// Adds a VTK-DataArray of the given name and datatype to the DOM tree and inserts the data-string at that node
 	void addDataArray(boost::property_tree::ptree &parent_node, const std::string &name, const std::string &data_type, const std::string &data, unsigned nComponents = 1);
 
-	bool write(std::ostream& stream);
+	bool write();
 
 	std::string _export_name;
 	MeshLib::Mesh* _mesh;
diff --git a/FileIO/XmlIO/Boost/BoostXmlCndInterface.cpp b/FileIO/XmlIO/Boost/BoostXmlCndInterface.cpp
index 66cd60d2c57b81e7b99852261bd5d12af3825289..82d906b356068c13af083e19a21315b7552ccf9c 100644
--- a/FileIO/XmlIO/Boost/BoostXmlCndInterface.cpp
+++ b/FileIO/XmlIO/Boost/BoostXmlCndInterface.cpp
@@ -166,7 +166,7 @@ void BoostXmlCndInterface::readDistributionTag(boost::property_tree::ptree const
 	}
 }
 
-bool BoostXmlCndInterface::write(std::ostream& )
+bool BoostXmlCndInterface::write()
 {
 	// no implementation - please use the Qt Xml writer for writing
 	return true;
diff --git a/FileIO/XmlIO/Boost/BoostXmlCndInterface.h b/FileIO/XmlIO/Boost/BoostXmlCndInterface.h
index 626395c4b8f631988ac6ace34b262550550fc72a..9ac6e50a20a0b7927d5f2f460c8c4b4fc23dc0f9 100644
--- a/FileIO/XmlIO/Boost/BoostXmlCndInterface.h
+++ b/FileIO/XmlIO/Boost/BoostXmlCndInterface.h
@@ -42,7 +42,7 @@ public:
 
 protected:
 	/// @return true on success, else false
-	bool write(std::ostream& );
+	bool write();
 
 private:
 	/// Read the details of a boundary condition from an xml-file
diff --git a/FileIO/XmlIO/Boost/BoostXmlGmlInterface.cpp b/FileIO/XmlIO/Boost/BoostXmlGmlInterface.cpp
index 67dfb1ed79494cdf7263cd5bc27e0b9db5e72a16..ae91ea491e5c5bde32419b2c0d0e489ee6a5d6a3 100644
--- a/FileIO/XmlIO/Boost/BoostXmlGmlInterface.cpp
+++ b/FileIO/XmlIO/Boost/BoostXmlGmlInterface.cpp
@@ -230,7 +230,7 @@ bool BoostXmlGmlInterface::isGmlFile(const boost::property_tree::ptree &root) co
 	return true;
 }
 
-bool BoostXmlGmlInterface::write(std::ostream&)
+bool BoostXmlGmlInterface::write()
 {
 	INFO ("Writing XML geometry is not implemented here. Please use the Qt XML class for this functionality.");
 	return false;
diff --git a/FileIO/XmlIO/Boost/BoostXmlGmlInterface.h b/FileIO/XmlIO/Boost/BoostXmlGmlInterface.h
index d33720a8c25cf4c99659773e3e7f9386711a15a8..197a3f54500a3ea7881049bbeba6826fb3f27270 100644
--- a/FileIO/XmlIO/Boost/BoostXmlGmlInterface.h
+++ b/FileIO/XmlIO/Boost/BoostXmlGmlInterface.h
@@ -44,7 +44,7 @@ public:
 
 protected:
 	/// Required method for writing geometry. This is not implemented here, use the Qt class for writing.
-	bool write(std::ostream&);
+	bool write();
 
 private:
 	/// Reads GeoLib::Point-objects from an xml-file
diff --git a/FileIO/XmlIO/Qt/XmlCndInterface.cpp b/FileIO/XmlIO/Qt/XmlCndInterface.cpp
index 0518a1b30e5f35089e1e2ec6f1e62496d351294a..328400e6c5a9da07e204c41dae12f5a38ed5e562 100644
--- a/FileIO/XmlIO/Qt/XmlCndInterface.cpp
+++ b/FileIO/XmlIO/Qt/XmlCndInterface.cpp
@@ -165,10 +165,10 @@ void XmlCndInterface::readConditions(const QDomNode &listRoot,
 	}
 }
 
-bool XmlCndInterface::write(std::ostream& stream)
+bool XmlCndInterface::write()
 {
-	stream << "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n"; // xml definition
-	stream << "<?xml-stylesheet type=\"text/xsl\" href=\"OpenGeoSysCND.xsl\"?>\n\n"; // stylefile definition
+	_out << "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n"; // xml definition
+	_out << "<?xml-stylesheet type=\"text/xsl\" href=\"OpenGeoSysCND.xsl\"?>\n\n"; // stylefile definition
 
 	QDomDocument doc("OGS-CND-DOM");
 	QDomElement root = doc.createElement("OpenGeoSysCond");
@@ -223,7 +223,7 @@ bool XmlCndInterface::write(std::ostream& stream)
 		}
 	}
 	std::string xml = doc.toString().toStdString();
-	stream << xml;
+	_out << xml;
 
 	return true;
 }
diff --git a/FileIO/XmlIO/Qt/XmlCndInterface.h b/FileIO/XmlIO/Qt/XmlCndInterface.h
index c758da945bfec842a1ac8eba674c808601b19c6b..44a2d96ffd160eea530cf0718d326cbc7e72d607 100644
--- a/FileIO/XmlIO/Qt/XmlCndInterface.h
+++ b/FileIO/XmlIO/Qt/XmlCndInterface.h
@@ -51,7 +51,7 @@ public:
 	void setConditionType(FEMCondition::CondType type) { _type = type; }
 
 protected:
-	bool write(std::ostream& stream);
+	bool write();
 
 private:
 	/// Read the details of various FEM Conditions from an xml-file
diff --git a/FileIO/XmlIO/Qt/XmlGmlInterface.cpp b/FileIO/XmlIO/Qt/XmlGmlInterface.cpp
index 758a917064d10049042a06c82ee27b3c0c6ebe8d..21aa24c642c4df601dd4c3a6210cc3d072e65961 100644
--- a/FileIO/XmlIO/Qt/XmlGmlInterface.cpp
+++ b/FileIO/XmlIO/Qt/XmlGmlInterface.cpp
@@ -185,7 +185,7 @@ void XmlGmlInterface::readSurfaces(const QDomNode &surfacesRoot,
 	}
 }
 
-bool XmlGmlInterface::write(std::ostream& stream)
+bool XmlGmlInterface::write()
 {
 	if (this->_exportName.empty())
 	{
@@ -195,8 +195,8 @@ bool XmlGmlInterface::write(std::ostream& stream)
 
 	std::size_t nPoints = 0, nPolylines = 0, nSurfaces = 0;
 
-	stream << "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n"; // xml definition
-	//stream << "<?xml-stylesheet type=\"text/xsl\" href=\"OpenGeoSysGLI.xsl\"?>\n\n"; // stylefile definition
+	_out << "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n"; // xml definition
+	//_out << "<?xml-stylesheet type=\"text/xsl\" href=\"OpenGeoSysGLI.xsl\"?>\n\n"; // stylefile definition
 
 	QDomDocument doc("OGS-GML-DOM");
 	QDomElement root = doc.createElement("OpenGeoSysGLI");
@@ -341,7 +341,7 @@ bool XmlGmlInterface::write(std::ostream& stream)
 
 	//insertStyleFileDefinition(filename);
 	std::string xml = doc.toString().toStdString();
-	stream << xml;
+	_out << xml;
 
 	return true;
 }
diff --git a/FileIO/XmlIO/Qt/XmlGmlInterface.h b/FileIO/XmlIO/Qt/XmlGmlInterface.h
index 9f53ea888baeea2cac21439d12ec0230dcf93fbb..c590216a9b207dc0f2ae955593d504240cdd987b 100644
--- a/FileIO/XmlIO/Qt/XmlGmlInterface.h
+++ b/FileIO/XmlIO/Qt/XmlGmlInterface.h
@@ -41,7 +41,7 @@ public:
 	bool readFile(std::string const& fname) { return readFile(QString(fname.c_str())) != 0; }
 
 protected:
-	bool write(std::ostream& stream);
+	bool write();
 
 private:
 	/// Reads GeoLib::Point-objects from an xml-file
diff --git a/FileIO/XmlIO/Qt/XmlGspInterface.cpp b/FileIO/XmlIO/Qt/XmlGspInterface.cpp
index daa1fabbe9d21e0a78b2244a2ec9996428c079f6..d4624cecfa0114a4c02cd2a17ab5dabd0f851416 100644
--- a/FileIO/XmlIO/Qt/XmlGspInterface.cpp
+++ b/FileIO/XmlIO/Qt/XmlGspInterface.cpp
@@ -105,14 +105,14 @@ int XmlGspInterface::writeToFile(std::string filename)
 	return FileIO::Writer::writeToFile(filename);
 }
 
-bool XmlGspInterface::write(std::ostream& stream)
+bool XmlGspInterface::write()
 {
 	GeoLib::GEOObjects* geoObjects = _project->getGEOObjects();
 	QFileInfo fi(QString::fromStdString(_filename));
 	std::string path((fi.absolutePath()).toStdString() + "/");
 
-	stream << "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n"; // xml definition
-	stream << "<?xml-stylesheet type=\"text/xsl\" href=\"OpenGeoSysProject.xsl\"?>\n\n"; // stylefile definition
+	_out << "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n"; // xml definition
+	_out << "<?xml-stylesheet type=\"text/xsl\" href=\"OpenGeoSysProject.xsl\"?>\n\n"; // stylefile definition
 
 	QDomDocument doc("OGS-PROJECT-DOM");
 	QDomElement root = doc.createElement("OpenGeoSysProject");
@@ -193,7 +193,7 @@ bool XmlGspInterface::write(std::ostream& stream)
 	}
 
 	std::string xml = doc.toString().toStdString();
-	stream << xml;
+	_out << xml;
 	return true;
 }
 }
diff --git a/FileIO/XmlIO/Qt/XmlGspInterface.h b/FileIO/XmlIO/Qt/XmlGspInterface.h
index c61eaa80fcae39b37fef4628345d575ff5b82fbc..437a1de6ae39a1aa39ccdd04b9719822703992f8 100644
--- a/FileIO/XmlIO/Qt/XmlGspInterface.h
+++ b/FileIO/XmlIO/Qt/XmlGspInterface.h
@@ -44,7 +44,7 @@ public:
 	int writeToFile(std::string filename);
 
 protected:
-	bool write(std::ostream& stream);
+	bool write();
 
 private:
 	std::string _filename;
diff --git a/FileIO/XmlIO/Qt/XmlStnInterface.cpp b/FileIO/XmlIO/Qt/XmlStnInterface.cpp
index 39c5b08dc89fa629c8ab40d5a97861eef3b307f5..c6db0dc5c413c0d67334d921b09004ae40e907a4 100644
--- a/FileIO/XmlIO/Qt/XmlStnInterface.cpp
+++ b/FileIO/XmlIO/Qt/XmlStnInterface.cpp
@@ -193,7 +193,7 @@ void XmlStnInterface::readStratigraphy( const QDomNode &stratRoot,
 	}
 }
 
-bool XmlStnInterface::write(std::ostream& stream)
+bool XmlStnInterface::write()
 {
 	if (this->_exportName.empty())
 	{
@@ -201,8 +201,8 @@ bool XmlStnInterface::write(std::ostream& stream)
 		return 0;
 	}
 
-	stream << "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n"; // xml definition
-	stream << "<?xml-stylesheet type=\"text/xsl\" href=\"OpenGeoSysSTN.xsl\"?>\n\n"; // stylefile definition
+	_out << "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n"; // xml definition
+	_out << "<?xml-stylesheet type=\"text/xsl\" href=\"OpenGeoSysSTN.xsl\"?>\n\n"; // stylefile definition
 
 	QDomDocument doc("OGS-STN-DOM");
 	QDomElement root = doc.createElement("OpenGeoSysSTN");
@@ -269,7 +269,7 @@ bool XmlStnInterface::write(std::ostream& stream)
 	}
 
 	std::string xml = doc.toString().toStdString();
-	stream << xml;
+	_out << xml;
 	return true;
 }
 
diff --git a/FileIO/XmlIO/Qt/XmlStnInterface.h b/FileIO/XmlIO/Qt/XmlStnInterface.h
index bcfa619c66219f11b231ef56a19a35c5c3e53aab..a9b6c32d918f6abdfbc3ad551f0138d2847e47a7 100644
--- a/FileIO/XmlIO/Qt/XmlStnInterface.h
+++ b/FileIO/XmlIO/Qt/XmlStnInterface.h
@@ -48,7 +48,7 @@ public:
 	int rapidReadFile(const std::string &fileName);
 
 protected:
-	bool write(std::ostream& stream);
+	bool write();
 
 private:
 	/// Reads GeoLib::Station- or StationBorehole-objects from an xml-file