StreamReader(流式读取器)

高效地读取以字符(默认为 \n,换行符)分隔的文件。返回的 String 中会省略分隔符。可以进行迭代。

import StreamReader

for line in StreamReader(path: Path.cwd/"foo") {
    print(line)
}

StreamReader(path: Path.home/"bar").compactMap(Int.init)