Skip to content
This repository was archived by the owner on Aug 18, 2020. It is now read-only.

Commit a711910

Browse files
committed
Don't use readAllBytes on inputstreams because it's a java 9 api
1 parent 54d0c16 commit a711910

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

updater/src/main/scala/Updater.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ object Updater {
220220
val currentJar = new JarFile(s"${conf.directory}/ChatOverflow.jar")
221221

222222
val tempNewJar = File.createTempFile("ChatOverflow-Updater", "")
223-
Files.write(tempNewJar.toPath, is.readAllBytes())
223+
Files.write(tempNewJar.toPath, Iterator.continually(is.read).takeWhile(_ != -1).map(_.toByte).toArray)
224224
val newJar = new JarFile(tempNewJar)
225225

226226
if (hashJar(currentJar) != hashJar(newJar)) {
@@ -255,7 +255,7 @@ object Updater {
255255
def hashJar(jar: JarFile): Int = {
256256
jar.entries().asScala
257257
.map(entry => jar.getInputStream(entry))
258-
.map(is => is.readAllBytes())
258+
.map(is => Iterator.continually(is.read).takeWhile(_ != -1).map(_.toByte).toArray)
259259
.map(arr => MurmurHash3.arrayHash(arr)).sum
260260
}
261261

0 commit comments

Comments
 (0)