blob: c6923cb9bdad025b40ab9a872a588985c8edce9e [file] [log] [blame]
Sergey Mashkov86f70612017-07-25 10:59:44 +03001package kotlinx.coroutines.experimental.io
2
Sergey Mashkov8158fec2017-07-25 15:33:11 +03003suspend fun ByteReadChannel.readASCIILine(estimate: Int = 16, limit: Int = Int.MAX_VALUE): String? {
Sergey Mashkov86f70612017-07-25 10:59:44 +03004 val sb = StringBuilder(estimate)
Sergey Mashkov8158fec2017-07-25 15:33:11 +03005 return if (readUTF8LineTo(sb, limit)) sb.toString() else null
Sergey Mashkov86f70612017-07-25 10:59:44 +03006}
7
Sergey Mashkov8158fec2017-07-25 15:33:11 +03008suspend fun ByteReadChannel.readUTF8Line(estimate: Int = 16, limit: Int = Int.MAX_VALUE): String? {
Sergey Mashkov86f70612017-07-25 10:59:44 +03009 val sb = StringBuilder(estimate)
Sergey Mashkov8158fec2017-07-25 15:33:11 +030010 return if (readUTF8LineTo(sb, limit)) sb.toString() else null
Sergey Mashkov86f70612017-07-25 10:59:44 +030011}
Sergey Mashkov8158fec2017-07-25 15:33:11 +030012
13@Deprecated("Use readUTF8Line or readASCIILine instead", ReplaceWith("readUTF8Line(estimate, limit)"))
14suspend fun ByteReadChannel.readLine(estimate: Int = 16, limit: Int = Int.MAX_VALUE): String? = readUTF8Line(estimate, limit)