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)
myRoot = FastJarVirtualFile(this, "", -1, DEFAULT_TIMESTAMP, null)
myRoot = FastJarVirtualFile(this, "", -1, null)
val filesByRelativePath = HashMap<String, FastJarVirtualFile>(ourEntryMap.size)
filesByRelativePath[""] = myRoot
@@ -64,8 +64,7 @@ class FastJarHandler(val fileSystem: FastJarFileSystem, path: String) {
FastJarVirtualFile(
this, shortName,
if (entry.isDirectory) -1 else entry.uncompressedSize.toLong(),
DEFAULT_TIMESTAMP,
if (entry.isDirectory) -1 else entry.uncompressedSize,
parentInfo
)
}
@@ -83,7 +82,7 @@ class FastJarHandler(val fileSystem: FastJarFileSystem, path: String) {
}
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 DEFAULT_TIMESTAMP = 0L
@@ -16,11 +16,10 @@ import java.io.OutputStream
internal class FastJarVirtualFile(
private val myHandler: FastJarHandler,
private val myName: CharSequence,
private val myLength: Long,
private val myTimestamp: Long,
parent: FastJarVirtualFile?
private val myLength: Int,
private val myParent: VirtualFile?
) : VirtualFile() {
private val myParent: VirtualFile? = parent
private var myChildren = EMPTY_ARRAY
fun setChildren(children: Array<VirtualFile>) {
myChildren = children
@@ -85,15 +84,12 @@ internal class FastJarVirtualFile(
return myHandler.contentsToByteArray(pair.second)
}
override fun getTimeStamp(): Long {
return myTimestamp
}
override fun getTimeStamp(): Long = 0
override fun getLength(): Long {
return myLength
}
override fun getLength(): Long = myLength.toLong()
override fun refresh(asynchronous: Boolean, recursive: Boolean, postRunnable: Runnable?) {}
@Throws(IOException::class)
override fun getInputStream(): InputStream {
return BufferExposingByteArrayInputStream(contentsToByteArray())