Skip to content
Snippets Groups Projects
Commit cbe35edd authored by guyslain.naves's avatar guyslain.naves
Browse files

improved Node

parent d11a6173
Branches
No related tags found
No related merge requests found
package com.univamu.svg;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.PrintStream;
import java.util.ArrayList;
......@@ -8,8 +7,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.univamu.svg.Attribute.tag;
public class Node {
private final String name;
......@@ -34,6 +31,12 @@ public class Node {
return this; // allows chaining of adds
}
public void toFile(String filepath) throws FileNotFoundException {
try (PrintStream out = new PrintStream(filepath)) {
out.println(this);
}
}
public String toString() {
StringBuilder builder = new StringBuilder();
this.appendTo(builder,0);
......@@ -55,9 +58,5 @@ public class Node {
}
public void toFile(String filepath) throws FileNotFoundException {
try (PrintStream out = new PrintStream(new File(filepath))) {
out.println(this);
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment