diff --git a/gradle.properties b/gradle.properties index 003a423..5df4e99 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ project_group = me.topchetoeu project_name = jscript -project_version = 0.9.5-beta +project_version = 0.9.6-beta main_class = me.topchetoeu.jscript.utils.JScriptRepl diff --git a/src/java/me/topchetoeu/jscript/common/Buffer.java b/src/java/me/topchetoeu/jscript/common/Buffer.java index 6ff4057..0840177 100644 --- a/src/java/me/topchetoeu/jscript/common/Buffer.java +++ b/src/java/me/topchetoeu/jscript/common/Buffer.java @@ -24,6 +24,11 @@ public class Buffer { return n; } + public void clear() { + data = new byte[128]; + length = 0; + } + public void append(byte b) { write(length, new byte[] { b }); } diff --git a/src/java/me/topchetoeu/jscript/utils/filesystem/File.java b/src/java/me/topchetoeu/jscript/utils/filesystem/File.java index c1b89c6..59757a3 100644 --- a/src/java/me/topchetoeu/jscript/utils/filesystem/File.java +++ b/src/java/me/topchetoeu/jscript/utils/filesystem/File.java @@ -99,6 +99,7 @@ public interface File { if (b == '\n') { try { writer.writeLine(new String(buff.data())); + buff.clear(); } catch (IOException e) { throw new FilesystemException(ErrorReason.UNKNOWN, e.getMessage());