fix: clear buffer of line writer file

This commit is contained in:
TopchetoEU 2024-03-05 17:10:06 +02:00
parent ccf75d6066
commit deaebac5fe
Signed by: topchetoeu
GPG Key ID: 6531B8583E5F6ED4
3 changed files with 7 additions and 1 deletions

View File

@ -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

View File

@ -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 });
}

View File

@ -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());