encapsulation of reader and writer for the exporter
merged last commits and use new StreamResourceProvider
use PrintWriter instead of manually writing newlines