Add support for source mappings #10
@ -24,6 +24,10 @@ public class Buffer {
|
||||
return n;
|
||||
}
|
||||
|
||||
public void append(byte b) {
|
||||
write(length, new byte[] { b });
|
||||
}
|
||||
|
||||
public byte[] data() {
|
||||
var res = new byte[length];
|
||||
System.arraycopy(this.data, 0, res, 0, length);
|
||||
@ -38,4 +42,12 @@ public class Buffer {
|
||||
this.length = data.length;
|
||||
System.arraycopy(data, 0, this.data, 0, data.length);
|
||||
}
|
||||
public Buffer(int capacity) {
|
||||
this.data = new byte[capacity];
|
||||
this.length = 0;
|
||||
}
|
||||
public Buffer() {
|
||||
this.data = new byte[128];
|
||||
this.length = 0;
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ public interface File {
|
||||
return new String(res);
|
||||
}
|
||||
default String readLine() {
|
||||
var res = new Buffer(new byte[0]);
|
||||
var res = new Buffer();
|
||||
var buff = new byte[1];
|
||||
|
||||
while (true) {
|
||||
|
@ -24,7 +24,7 @@ public class MemoryFilesystem implements Filesystem {
|
||||
if (!folders.contains(_path.getParent())) throw new FilesystemException(path, FSCode.DOESNT_EXIST);
|
||||
if (folders.contains(_path) || files.containsKey(_path)) throw new FilesystemException(path, FSCode.ALREADY_EXISTS);
|
||||
if (folders.contains(_path)) throw new FilesystemException(path, FSCode.ALREADY_EXISTS);
|
||||
files.put(_path, new Buffer(new byte[0]));
|
||||
files.put(_path, new Buffer());
|
||||
break;
|
||||
case FOLDER:
|
||||
if (!folders.contains(_path.getParent())) throw new FilesystemException(path, FSCode.DOESNT_EXIST);
|
||||
|
Loading…
Reference in New Issue
Block a user