Skip to content

Commit 757154b

Browse files
daplffwcd
andauthored
Update server/src/main/kotlin/org/javacs/kt/externalsources/KlsURI.kt
Co-authored-by: FW <[email protected]>
1 parent 747d3f3 commit 757154b

File tree

1 file changed

+4
-3
lines changed
  • server/src/main/kotlin/org/javacs/kt/externalsources

1 file changed

+4
-3
lines changed

server/src/main/kotlin/org/javacs/kt/externalsources/KlsURI.kt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,13 +113,14 @@ data class KlsURI(val fileUri: URI, val query: Map<QueryParam, String>) {
113113
return result
114114
}
115115

116-
fun readContents(): String {
117-
return if (archiveType == ArchiveType.ZIP) {
116+
fun readContents(): String = when (archiveType) {
117+
ArchiveType.ZIP -> {
118118
val zipFile = ZipFile(File("$archivePath"))
119119
zipFile.getInputStream(zipFile.getEntry(innerPath.trimStart('/')))
120120
.bufferedReader()
121121
.use(BufferedReader::readText)
122-
} else {
122+
}
123+
ArchiveType.JAR, ArchiveType.JDK -> {
123124
withJarURLConnection {
124125
it.jarFile
125126
.getInputStream(it.jarEntry)

0 commit comments

Comments
 (0)