Revision 479 tmp/org.txm.groovy.core/src/groovy/org/txm/importer/StaxStackWriter.groovy

StaxStackWriter.groovy (revision 479)
13 13
	OutputStream output;
14 14
	def events = [];
15 15
	
16
	public StaxStackWriter(File file) {
17
		this(new BufferedOutputStream(new FileOutputStream(file)));
18
	}
19
	
16 20
	public StaxStackWriter(File file, String encoding) {
17
		XMLOutputFactory factory = XMLOutputFactory.newInstance();
18
		this.output = new BufferedOutputStream(new FileOutputStream(file));
19
		this.writer = factory.createXMLStreamWriter(output, encoding); //create a new file
21
		this(new BufferedOutputStream(new FileOutputStream(file)), encoding);
20 22
	}
21 23
	
24
	public StaxStackWriter(OutputStream output) {
25
		this(output, "UTF-8");//create a new file
26
	}
27
	
22 28
	public StaxStackWriter(OutputStream output, String encoding) {
23 29
		XMLOutputFactory factory = XMLOutputFactory.newInstance();
24 30
		this.output = output
25 31
		this.writer = factory.createXMLStreamWriter(output, encoding);//create a new file
26 32
	}
27
	
28
	public StaxStackWriter(OutputStream output) {
29
		XMLOutputFactory factory = XMLOutputFactory.newInstance();
30
		this.output = output
31
		this.writer = factory.createXMLStreamWriter(output, "UTF-8");//create a new file
32
	}
33 33

  
34 34
	Charset UTF8 = Charset.forName("UTF-8");
35 35
	public void write(String txt) {

Also available in: Unified diff