Skip to content

Commit 2299b60

Browse files
committed
Write-back uses unbuffered writer
Encoder has 8Kb buffer.
1 parent b5e2279 commit 2299b60

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

compiler/src/dotty/tools/dotc/rewrites/Rewrites.scala

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,11 @@ object Rewrites {
5656
ds
5757
}
5858

59-
def writeBack(): Unit = {
59+
def writeBack(): Unit =
6060
val chars = apply(source.underlying.content)
61-
val bytes = new String(chars).getBytes(UTF_8)
62-
val out = source.file.output
63-
out.write(bytes)
64-
out.close()
65-
}
61+
val osw = OutputStreamWriter(source.file.output, UTF_8)
62+
try osw.write(chars, 0, chars.length)
63+
finally osw.close()
6664
}
6765

6866
/** If -rewrite is set, record a patch that replaces the range

0 commit comments

Comments
 (0)