Skip to content
This repository has been archived by the owner on May 15, 2019. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'eengbrec/serializer_fix'
Browse files Browse the repository at this point in the history
  • Loading branch information
djspiewak committed Oct 1, 2011
2 parents f17cfc0 + 753ccff commit b56ce1e
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/main/scala/com/codecommit/antixml/XMLSerializer.scala
Expand Up @@ -63,11 +63,18 @@ class XMLSerializer(encoding: String, outputDeclaration: Boolean) {
* Uses the character encoding of this XMLSerializer (default is UTF-8).
*/
def serializeDocument(elem: Elem, o: OutputStream) {
serializeDocument(elem, new OutputStreamWriter(o, encoding))
val writer = new OutputStreamWriter(o, encoding)
serializeDocument(elem, writer)
writer.flush()
}

def serializeDocument(elem: Elem, outputFile: File) {
serializeDocument(elem, new FileOutputStream(outputFile))
val fos = new FileOutputStream(outputFile)
try {
serializeDocument(elem, fos)
} finally {
fos.close()
}
}

def serialize(elem: Elem, w: Writer) {
Expand Down

0 comments on commit b56ce1e

Please sign in to comment.