Some progress on the JSON parsers

This commit is contained in:
Ziver Koc 2013-06-07 15:50:47 +00:00
parent e03d12263a
commit 22adf3b7f2
2 changed files with 85 additions and 8 deletions

View file

@ -27,6 +27,7 @@ import java.io.PrintStream;
import java.io.PrintWriter;
import java.util.Iterator;
import zutil.io.StringOutputStream;
import zutil.parser.DataNode;
import zutil.parser.DataNode.DataType;
@ -123,5 +124,15 @@ public class JSONWriter{
public void close(){
out.close();
}
/**
* @return JSON String that is generated from the input DataNode graph
*/
public String toString(DataNode root){
StringOutputStream out = new StringOutputStream();
JSONWriter writer = new JSONWriter(out);
writer.write(root);
writer.close();
return out.toString();
}
}