Sergey Mashkov | 86f7061 | 2017-07-25 10:59:44 +0300 | [diff] [blame] | 1 | package kotlinx.coroutines.experimental.io |
| 2 | |
Sergey Mashkov | 8158fec | 2017-07-25 15:33:11 +0300 | [diff] [blame] | 3 | suspend fun ByteReadChannel.readASCIILine(estimate: Int = 16, limit: Int = Int.MAX_VALUE): String? { |
Sergey Mashkov | 86f7061 | 2017-07-25 10:59:44 +0300 | [diff] [blame] | 4 | val sb = StringBuilder(estimate) |
Sergey Mashkov | 8158fec | 2017-07-25 15:33:11 +0300 | [diff] [blame] | 5 | return if (readUTF8LineTo(sb, limit)) sb.toString() else null |
Sergey Mashkov | 86f7061 | 2017-07-25 10:59:44 +0300 | [diff] [blame] | 6 | } |
| 7 | |
Sergey Mashkov | 8158fec | 2017-07-25 15:33:11 +0300 | [diff] [blame] | 8 | suspend fun ByteReadChannel.readUTF8Line(estimate: Int = 16, limit: Int = Int.MAX_VALUE): String? { |
Sergey Mashkov | 86f7061 | 2017-07-25 10:59:44 +0300 | [diff] [blame] | 9 | val sb = StringBuilder(estimate) |
Sergey Mashkov | 8158fec | 2017-07-25 15:33:11 +0300 | [diff] [blame] | 10 | return if (readUTF8LineTo(sb, limit)) sb.toString() else null |
Sergey Mashkov | 86f7061 | 2017-07-25 10:59:44 +0300 | [diff] [blame] | 11 | } |
Sergey Mashkov | 8158fec | 2017-07-25 15:33:11 +0300 | [diff] [blame] | 12 | |
| 13 | @Deprecated("Use readUTF8Line or readASCIILine instead", ReplaceWith("readUTF8Line(estimate, limit)")) |
| 14 | suspend fun ByteReadChannel.readLine(estimate: Int = 16, limit: Int = Int.MAX_VALUE): String? = readUTF8Line(estimate, limit) |