com.dipien.byebyejetifier.archive.ArchiveFile.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bye-bye-jetifier Show documentation
Show all versions of bye-bye-jetifier Show documentation
Gradle Plugin to verify if you can keep Android Jetifier disabled
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)
}