Minor, remove obsolete JDK 6-related workaround
This commit is contained in:
@@ -33,16 +33,11 @@ task("prepare") {
|
|||||||
|
|
||||||
fun loadAllFromJar(file: File): Map<String, Pair<JarEntry, ByteArray>> {
|
fun loadAllFromJar(file: File): Map<String, Pair<JarEntry, ByteArray>> {
|
||||||
val result = hashMapOf<String, Pair<JarEntry, ByteArray>>()
|
val result = hashMapOf<String, Pair<JarEntry, ByteArray>>()
|
||||||
val jar = JarFile(file)
|
JarFile(file).use { jar ->
|
||||||
try {
|
|
||||||
for (jarEntry in jar.entries()) {
|
for (jarEntry in jar.entries()) {
|
||||||
result[jarEntry.name] = Pair(jarEntry, jar.getInputStream(jarEntry).readBytes())
|
result[jarEntry.name] = Pair(jarEntry, jar.getInputStream(jarEntry).readBytes())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
finally {
|
|
||||||
// Yes, JarFile does not extend Closeable on JDK 6 so we can't use "use" here
|
|
||||||
jar.close()
|
|
||||||
}
|
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user