Minor. Rename properties in FastJarVirtualFile

This commit is contained in:
Denis.Zharkov
2021-08-03 18:01:03 +03:00
committed by teamcityserver
parent 6cd3d84e74
commit 4e66fd29e0
2 changed files with 18 additions and 18 deletions
@@ -30,7 +30,7 @@ class FastJarHandler(val fileSystem: FastJarFileSystem, path: String) {
} }
} }
myRoot = FastJarVirtualFile(this, "", -1, myParent = null, entryDescription = null) myRoot = FastJarVirtualFile(this, "", -1, parent = null, entryDescription = null)
// ByteArrayCharSequence should not be used instead of String // ByteArrayCharSequence should not be used instead of String
// because the former class does not support equals/hashCode properly // because the former class does not support equals/hashCode properly
@@ -13,10 +13,10 @@ import java.io.InputStream
import java.io.OutputStream import java.io.OutputStream
internal class FastJarVirtualFile( internal class FastJarVirtualFile(
private val myHandler: FastJarHandler, private val handler: FastJarHandler,
private val myName: CharSequence, private val name: CharSequence,
private val myLength: Int, private val length: Int,
private val myParent: FastJarVirtualFile?, private val parent: FastJarVirtualFile?,
private val entryDescription: ZipEntryDescription?, private val entryDescription: ZipEntryDescription?,
) : VirtualFile() { ) : VirtualFile() {
@@ -24,7 +24,7 @@ internal class FastJarVirtualFile(
private val myChildrenList: MutableList<VirtualFile> = mutableListOf() private val myChildrenList: MutableList<VirtualFile> = mutableListOf()
init { init {
myParent?.myChildrenList?.add(this) parent?.myChildrenList?.add(this)
} }
fun initChildrenArrayFromList() { fun initChildrenArrayFromList() {
@@ -33,28 +33,28 @@ internal class FastJarVirtualFile(
} }
override fun getName(): String { override fun getName(): String {
return myName.toString() return name.toString()
} }
override fun getNameSequence(): CharSequence { override fun getNameSequence(): CharSequence {
return myName return name
} }
override fun getFileSystem(): VirtualFileSystem { override fun getFileSystem(): VirtualFileSystem {
return myHandler.fileSystem return handler.fileSystem
} }
override fun getPath(): String { override fun getPath(): String {
if (myParent == null) { if (parent == null) {
return FileUtil.toSystemIndependentName(myHandler.file.path) + "!/" return FileUtil.toSystemIndependentName(handler.file.path) + "!/"
} }
val parentPath = myParent.path val parentPath = parent.path
val answer = StringBuilder(parentPath.length + 1 + myName.length) val answer = StringBuilder(parentPath.length + 1 + name.length)
answer.append(parentPath) answer.append(parentPath)
if (answer[answer.length - 1] != '/') { if (answer[answer.length - 1] != '/') {
answer.append('/') answer.append('/')
} }
answer.append(myName) answer.append(name)
return answer.toString() return answer.toString()
} }
@@ -63,7 +63,7 @@ internal class FastJarVirtualFile(
} }
override fun isDirectory(): Boolean { override fun isDirectory(): Boolean {
return myLength < 0 return length < 0
} }
override fun isValid(): Boolean { override fun isValid(): Boolean {
@@ -71,7 +71,7 @@ internal class FastJarVirtualFile(
} }
override fun getParent(): VirtualFile? { override fun getParent(): VirtualFile? {
return myParent return parent
} }
override fun getChildren(): Array<VirtualFile> { override fun getChildren(): Array<VirtualFile> {
@@ -86,12 +86,12 @@ internal class FastJarVirtualFile(
@Throws(IOException::class) @Throws(IOException::class)
override fun contentsToByteArray(): ByteArray { override fun contentsToByteArray(): ByteArray {
if (entryDescription == null) return EMPTY_BYTE_ARRAY if (entryDescription == null) return EMPTY_BYTE_ARRAY
return myHandler.contentsToByteArray(entryDescription) return handler.contentsToByteArray(entryDescription)
} }
override fun getTimeStamp(): Long = 0 override fun getTimeStamp(): Long = 0
override fun getLength(): Long = myLength.toLong() override fun getLength(): Long = length.toLong()
override fun refresh(asynchronous: Boolean, recursive: Boolean, postRunnable: Runnable?) {} override fun refresh(asynchronous: Boolean, recursive: Boolean, postRunnable: Runnable?) {}