File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed
core/src/main/kotlin/com/fractalwrench/json2kotlin Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -2,13 +2,15 @@ package com.fractalwrench.json2kotlin
22
33import com.squareup.kotlinpoet.FileSpec
44import com.squareup.kotlinpoet.TypeSpec
5+ import java.io.BufferedWriter
56import java.io.OutputStream
7+ import java.io.OutputStreamWriter
68import java.util.*
79
810/* *
911 * Writes a collection of types to a source file OutputStream.
1012 */
11- internal class SourceFileWriter { // TODO rename once functionality has changed
13+ internal class SourceFileWriter {
1214
1315 /* *
1416 * Writes a collection of types to a source file OutputStream.
@@ -21,10 +23,9 @@ internal class SourceFileWriter { // TODO rename once functionality has changed
2123 sourceFile.addType(stack.pop())
2224 }
2325
24- with (StringBuilder ()) { // FIXME inefficient use of resources
25- sourceFile.build().writeTo(this )
26- output.write(toString().toByteArray())
27- }
26+ val bufferedWriter = BufferedWriter (OutputStreamWriter (output))
27+ sourceFile.build().writeTo(bufferedWriter)
28+ bufferedWriter.flush()
2829 }
2930
3031}
You can’t perform that action at this time.
0 commit comments