From 82e6cea22bce45fba9365f45e754650f5edca6ea Mon Sep 17 00:00:00 2001 From: charagarlnad <27380203+charagarlnad@users.noreply.github.com> Date: Sat, 14 Dec 2024 09:38:59 -0500 Subject: [PATCH] use buffer in LuaStateFactory file comparison (#137) --- .../li/cil/oc/server/machine/luac/LuaStateFactory.scala | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/scala/li/cil/oc/server/machine/luac/LuaStateFactory.scala b/src/main/scala/li/cil/oc/server/machine/luac/LuaStateFactory.scala index d233628de1..ceebb3890f 100644 --- a/src/main/scala/li/cil/oc/server/machine/luac/LuaStateFactory.scala +++ b/src/main/scala/li/cil/oc/server/machine/luac/LuaStateFactory.scala @@ -1,5 +1,6 @@ package li.cil.oc.server.machine.luac +import java.io.BufferedInputStream import java.io.File import java.io.FileInputStream import java.io.FileOutputStream @@ -242,8 +243,8 @@ abstract class LuaStateFactory { if (tmpLibFile.exists()) { var matching = true try { - val inCurrent = libraryUrl.openStream() - val inExisting = new FileInputStream(tmpLibFile) + val inCurrent = new BufferedInputStream(libraryUrl.openStream()) + val inExisting = new BufferedInputStream(new FileInputStream(tmpLibFile)) var inCurrentByte = 0 var inExistingByte = 0 do {