diff options
author | Lukas Rytz <lukas.rytz@typesafe.com> | 2015-10-05 10:27:44 +0200 |
---|---|---|
committer | Lukas Rytz <lukas.rytz@typesafe.com> | 2015-10-05 10:27:44 +0200 |
commit | bb3ded3826adbb52b23725a93d6d51fc127b5623 (patch) | |
tree | fa1683214211870acb50d8a578cdbc7d7de465f3 /src/reflect | |
parent | ab4408e307d3010e62f877073a96e41239abc2ce (diff) | |
parent | 80e4f5431c3c7efe3e13406b79a10ab9d274d460 (diff) | |
download | scala-bb3ded3826adbb52b23725a93d6d51fc127b5623.tar.gz scala-bb3ded3826adbb52b23725a93d6d51fc127b5623.tar.bz2 scala-bb3ded3826adbb52b23725a93d6d51fc127b5623.zip |
Merge pull request #4770 from SethTisue/windows-testing-fixes
get test suite passing on Windows
Diffstat (limited to 'src/reflect')
-rw-r--r-- | src/reflect/scala/reflect/io/Streamable.scala | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/reflect/scala/reflect/io/Streamable.scala b/src/reflect/scala/reflect/io/Streamable.scala index aa47947672..99a14d1fb0 100644 --- a/src/reflect/scala/reflect/io/Streamable.scala +++ b/src/reflect/scala/reflect/io/Streamable.scala @@ -27,6 +27,10 @@ object Streamable { * efficient method implementations. * * ''Note: This library is considered experimental and should not be used unless you know what you are doing.'' + * + * Note that this code was not written with resource management in mind. + * Several methods (such as `chars` and `lines`) create InputStreams they + * don't close */ trait Bytes { def inputStream(): InputStream @@ -82,9 +86,13 @@ object Streamable { */ def creationCodec: Codec = implicitly[Codec] + /** Caller is responsible for closing the returned BufferedSource. */ def chars(codec: Codec): BufferedSource = Source.fromInputStream(inputStream())(codec) + /** Beware! Leaks an InputStream which will not be closed until it gets finalized. */ def lines(): Iterator[String] = lines(creationCodec) + + /** Beware! Leaks an InputStream which will not be closed until it gets finalized. */ def lines(codec: Codec): Iterator[String] = chars(codec).getLines() /** Obtains an InputStreamReader wrapped around a FileInputStream. |