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