Adapt FastJarVirtualFile constructor to its usages

This commit is contained in:
Denis.Zharkov
2021-07-30 12:56:25 +03:00
committed by teamcityserver
parent 920d57563b
commit 1a262c9c31
2 changed files with 9 additions and 16 deletions
@@ -32,7 +32,7 @@ class FastJarHandler(val fileSystem: FastJarFileSystem, path: String) {
} }
val childrenMap = HashMap<FastJarVirtualFile, MutableList<VirtualFile>>(ourEntryMap.size) val childrenMap = HashMap<FastJarVirtualFile, MutableList<VirtualFile>>(ourEntryMap.size)
myRoot = FastJarVirtualFile(this, "", -1, DEFAULT_TIMESTAMP, null) myRoot = FastJarVirtualFile(this, "", -1, null)
val filesByRelativePath = HashMap<String, FastJarVirtualFile>(ourEntryMap.size) val filesByRelativePath = HashMap<String, FastJarVirtualFile>(ourEntryMap.size)
filesByRelativePath[""] = myRoot filesByRelativePath[""] = myRoot
@@ -64,8 +64,7 @@ class FastJarHandler(val fileSystem: FastJarFileSystem, path: String) {
FastJarVirtualFile( FastJarVirtualFile(
this, shortName, this, shortName,
if (entry.isDirectory) -1 else entry.uncompressedSize.toLong(), if (entry.isDirectory) -1 else entry.uncompressedSize,
DEFAULT_TIMESTAMP,
parentInfo parentInfo
) )
} }
@@ -83,7 +82,7 @@ class FastJarHandler(val fileSystem: FastJarFileSystem, path: String) {
} }
val parentInfo = getOrCreateDirectory(parentPath, map) val parentInfo = getOrCreateDirectory(parentPath, map)
FastJarVirtualFile(this, shortName, -1, DEFAULT_TIMESTAMP, parentInfo) FastJarVirtualFile(this, shortName, -1, parentInfo)
} }
} }
@@ -116,5 +115,3 @@ class FastJarHandler(val fileSystem: FastJarFileSystem, path: String) {
} }
private const val MANIFEST_PATH = "META-INF/MANIFEST.MF" private const val MANIFEST_PATH = "META-INF/MANIFEST.MF"
private const val DEFAULT_TIMESTAMP = 0L
@@ -16,11 +16,10 @@ import java.io.OutputStream
internal class FastJarVirtualFile( internal class FastJarVirtualFile(
private val myHandler: FastJarHandler, private val myHandler: FastJarHandler,
private val myName: CharSequence, private val myName: CharSequence,
private val myLength: Long, private val myLength: Int,
private val myTimestamp: Long, private val myParent: VirtualFile?
parent: FastJarVirtualFile?
) : VirtualFile() { ) : VirtualFile() {
private val myParent: VirtualFile? = parent
private var myChildren = EMPTY_ARRAY private var myChildren = EMPTY_ARRAY
fun setChildren(children: Array<VirtualFile>) { fun setChildren(children: Array<VirtualFile>) {
myChildren = children myChildren = children
@@ -85,15 +84,12 @@ internal class FastJarVirtualFile(
return myHandler.contentsToByteArray(pair.second) return myHandler.contentsToByteArray(pair.second)
} }
override fun getTimeStamp(): Long { override fun getTimeStamp(): Long = 0
return myTimestamp
}
override fun getLength(): Long { override fun getLength(): Long = myLength.toLong()
return myLength
}
override fun refresh(asynchronous: Boolean, recursive: Boolean, postRunnable: Runnable?) {} override fun refresh(asynchronous: Boolean, recursive: Boolean, postRunnable: Runnable?) {}
@Throws(IOException::class) @Throws(IOException::class)
override fun getInputStream(): InputStream { override fun getInputStream(): InputStream {
return BufferExposingByteArrayInputStream(contentsToByteArray()) return BufferExposingByteArrayInputStream(contentsToByteArray())