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

com.dipien.byebyejetifier.archive.ArchiveFile.kt Maven / Gradle / Ivy

There is a newer version: 1.2.2
Show newest version
package com.dipien.byebyejetifier.archive

import com.dipien.byebyejetifier.scanner.ScanResult
import java.nio.file.Path

/**
 * Represents a file in the archive that is not an archive.
 */
class ArchiveFile(relativePath: Path, data: ByteArray) : ArchiveItem {

    override var relativePath = relativePath
        private set

    override var fileName: String = relativePath.fileName.toString()
        private set

    var data: ByteArray = data
        private set

    override fun accept(visitor: ArchiveItemVisitor, scanResults: MutableList) {
        visitor.visit(this, scanResults)
    }

    fun isLayoutResource() = relativePath.toString().startsWith("res/layout", ignoreCase = true) &&
        fileName.endsWith(".xml", ignoreCase = true)

    fun isAndroidManifestFile() = fileName.endsWith("AndroidManifest.xml", ignoreCase = true)

    fun isClassFile() = fileName.endsWith(".class", ignoreCase = true)
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy