diff options
Diffstat (limited to 'src/reflect')
-rw-r--r-- | src/reflect/scala/reflect/io/Streamable.scala | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/reflect/scala/reflect/io/Streamable.scala b/src/reflect/scala/reflect/io/Streamable.scala index 6184c6776a..1d51ad7f54 100644 --- a/src/reflect/scala/reflect/io/Streamable.scala +++ b/src/reflect/scala/reflect/io/Streamable.scala @@ -106,7 +106,10 @@ object Streamable { /** Convenience function to import entire file into a String. */ def slurp(): String = slurp(creationCodec) - def slurp(codec: Codec) = chars(codec).mkString + def slurp(codec: Codec) = { + val src = chars(codec) + try src.mkString finally src.close() // Always Be Closing + } } /** Call a function on something Closeable, finally closing it. */ |