Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package splitter
- import java.io.File
- import java.io.FileNotFoundException
- import java.util.*
- data class RawLog(val fights : Array<RawFight>)
- data class RawFight(val start :Date, val end :Date, val posStart :Int, val posEnd :Int)
- class LogSplitter(private val logFile :File) {
- fun findFights() {
- if (!logFile.exists() or !logFile.isFile) throw FileNotFoundException("Cannot access logfile at " + logFile.absolutePath)
- val br = logFile.bufferedReader()
- var currentLine = br.readLine()
- var lineCounter = if (currentLine == null) 0 else 1000000
- val startingTime : Long
- println("Starting").also { startingTime = System.currentTimeMillis() }
- while (currentLine != null) {
- if (currentLine.contains("ENCOUNTER_START", false)) println(currentLine)
- currentLine = br.readLine().also { lineCounter++ }
- }
- println("Done in " + System.currentTimeMillis().minus(startingTime).div(1000) + "s")
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement