All Downloads are FREE. Search and download functionalities are using the official Maven repository.

xyz.capybara.clamav.commands.VersionCommands.kt Maven / Gradle / Ivy

There is a newer version: 2.1.2
Show newest version
package xyz.capybara.clamav.commands

import xyz.capybara.clamav.InvalidResponseException

object VersionCommands : Command>() {
    const private val COMMANDS_START_TAG = "| COMMANDS:"

    override val commandString: String
        get() = "VERSIONCOMMANDS"

    override val format: Command.CommandFormat
        get() = Command.CommandFormat.NEW_LINE

    override fun parseResponse(responseString: String): Collection {
        val commandsStartPos = responseString.indexOf(COMMANDS_START_TAG)
        return when (commandsStartPos) {
            -1 -> throw InvalidResponseException(responseString)
            else -> responseString.substring(commandsStartPos + COMMANDS_START_TAG.length).split(" ".toRegex())
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy