public Writer constructWriter() throws IOException { String enc = getEncoding(); if (enc != null && enc.length() > 0) { return new OutputStreamWriter(constructOutputStream(), enc); } // Sub-optimal; really shouldn't use the platform default encoding return new FileWriter(mFile); }
/** * Method for constructing Stax stream writer to write xml content * to specified file. * Underlying stream writer will be constructed using Stax factory * this StaxMate factory was constructed with. *<p> * Encoding used will be UTF-8. */ public XMLStreamWriter2 createStax2Writer(File f) throws XMLStreamException { if (_stax2Factory != null) { /* have real stax2 factory; can create more optimal writer * (most importantly: one that automatically closes the writer) */ Stax2FileResult res = new Stax2FileResult(f); return (XMLStreamWriter2) _stax2Factory.createXMLStreamWriter(res); } /* No, just stax1 factory. Could use StreamResult; but some * impls might not recognize it... immediate problem here: * auto-closing won't work. */ try { FileOutputStream out = new FileOutputStream(f); return Stax2WriterAdapter.wrapIfNecessary(_staxFactory.createXMLStreamWriter(out)); } catch (FileNotFoundException fex) { throw new XMLStreamException(fex); } }
/** * Method for constructing Stax stream writer to write xml content * to specified file. * Underlying stream writer will be constructed using Stax factory * this StaxMate factory was constructed with. *<p> * Encoding used will be UTF-8. */ public XMLStreamWriter2 createStax2Writer(File f) throws XMLStreamException { if (_stax2Factory != null) { /* have real stax2 factory; can create more optimal writer * (most importantly: one that automatically closes the writer) */ Stax2FileResult res = new Stax2FileResult(f); return (XMLStreamWriter2) _stax2Factory.createXMLStreamWriter(res); } /* No, just stax1 factory. Could use StreamResult; but some * impls might not recognize it... immediate problem here: * auto-closing won't work. */ try { FileOutputStream out = new FileOutputStream(f); return Stax2WriterAdapter.wrapIfNecessary(_staxFactory.createXMLStreamWriter(out)); } catch (FileNotFoundException fex) { throw new XMLStreamException(fex); } }
public Writer constructWriter() throws IOException { String enc = getEncoding(); if (enc != null && enc.length() > 0) { return new OutputStreamWriter(constructOutputStream(), enc); } // Sub-optimal; really shouldn't use the platform default encoding return new FileWriter(mFile); }
public Writer constructWriter() throws IOException { String enc = getEncoding(); if (enc != null && enc.length() > 0) { return new OutputStreamWriter(constructOutputStream(), enc); } // Sub-optimal; really shouldn't use the platform default encoding return new FileWriter(mFile); }
public Writer constructWriter() throws IOException { String enc = getEncoding(); if (enc != null && enc.length() > 0) { return new OutputStreamWriter(constructOutputStream(), enc); } // Sub-optimal; really shouldn't use the platform default encoding return new FileWriter(mFile); }