Fixed string(), added lines() support
This commit is contained in:
parent
db1118a733
commit
1697108b5c
@ -82,10 +82,8 @@ open class AsyncProcessOutput(private val channel: Channel<Byte>) {
|
|||||||
/**
|
/**
|
||||||
* @return output of the finished process converted to a String using platform's default encoding.
|
* @return output of the finished process converted to a String using platform's default encoding.
|
||||||
*/
|
*/
|
||||||
val string: String
|
suspend fun string(): String {
|
||||||
get() {
|
return String(getBuffered())
|
||||||
// return String(getBuffered())
|
|
||||||
return ""
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -109,4 +107,27 @@ open class AsyncProcessOutput(private val channel: Channel<Byte>) {
|
|||||||
throw IllegalStateException(e.message)
|
throw IllegalStateException(e.message)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return output lines of the finished process converted using platform's default encoding.
|
||||||
|
*/
|
||||||
|
suspend fun lines(): List<String> {
|
||||||
|
return ProcessOutput.getLinesFrom(string())
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return output lines of the finished process converted using UTF-8.
|
||||||
|
*/
|
||||||
|
suspend fun linesAsUtf8(): List<String> {
|
||||||
|
return ProcessOutput.getLinesFrom(utf8())
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param charset The name of a supported char set.
|
||||||
|
*
|
||||||
|
* @return output lines of the finished process converted using a given char set.
|
||||||
|
*/
|
||||||
|
suspend fun getLines(charset: Charset): List<String> {
|
||||||
|
return ProcessOutput.getLinesFrom(getString(charset))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user