Utility classes

This commit is contained in:
Imbus 2024-06-03 19:31:56 +02:00
parent a56a3be9ef
commit 7b3ddf17e0
3 changed files with 4 additions and 52 deletions

View file

@ -1,27 +0,0 @@
package xl.util;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.util.Map;
// TODO move to another package
public class XLBufferedReader extends BufferedReader {
public XLBufferedReader(String name) throws FileNotFoundException {
super(new FileReader(name));
}
// TODO Change Object to something appropriate
public void load(Map<String, Object> map) {
try {
while (ready()) {
String string = readLine();
int i = string.indexOf('=');
// TODO
}
} catch (Exception e) {
throw new XLException(e.getMessage());
}
}
}

View file

@ -2,6 +2,10 @@ package xl.util;
public class XLException extends RuntimeException {
public static final XLException ERROR_RECURSIVE = new XLException("Error: Circular Dependency");
public static final XLException ERROR_EMPTY_REF = new XLException("Empty: Reference to empty cell");
public static final XLException ERROR_CREATECELL = new XLException("Error: Could not create cell");
public XLException(String message) {
super(message);
}

View file

@ -1,25 +0,0 @@
package xl.util;
import java.io.FileNotFoundException;
import java.io.PrintStream;
import java.util.Map.Entry;
import java.util.Set;
// TODO move to another package
public class XLPrintStream extends PrintStream {
public XLPrintStream(String fileName) throws FileNotFoundException {
super(fileName);
}
// TODO Change Object to something appropriate
public void save(Set<Entry<String, Object>> set) {
for (Entry<String, Object> entry : set) {
print(entry.getKey());
print('=');
println(entry.getValue());
}
flush();
close();
}
}