JUST PLAYING AROUND
This commit is contained in:
parent
85cc61934c
commit
a33afc99f6
|
@ -24,16 +24,12 @@ fun isConnected(): Boolean {
|
|||
// convert inputstream to String
|
||||
@Throws(IOException::class)
|
||||
fun InputStream.findVersion(): String? {
|
||||
var version: String? = null
|
||||
val regex = "(.*)version(.*)\"(((\\d+)\\.)+(\\d+))\"(.*)"
|
||||
|
||||
this.bufferedReader().forEachLine {
|
||||
if (regex.toRegex().matches(it)) {
|
||||
version = regex.toRegex().matchEntire(it)?.groupValues?.getOrNull(3)
|
||||
return@forEachLine
|
||||
}
|
||||
}
|
||||
return version
|
||||
val regex = "(.*)version(.*)\"(((\\d+)\\.)+(\\d+))\"(.*)".toRegex()
|
||||
return bufferedReader()
|
||||
.readLines()
|
||||
.filter { regex.matches(it) }
|
||||
.mapNotNull { regex.matchEntire(it)?.groupValues?.getOrNull(3) }
|
||||
.firstOrNull()
|
||||
}
|
||||
|
||||
private val log = LoggerFactory.getLogger(L.CORE)
|
||||
|
|
Loading…
Reference in a new issue