Skip to content

Commit

Permalink
function change
Browse files Browse the repository at this point in the history
  • Loading branch information
XenoAmess committed Dec 16, 2018
1 parent 5b60019 commit 9f691cb
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 8 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.xenoamess</groupId>
<artifactId>x8l</artifactId>
<version>0.33</version>
<version>0.34</version>
</project>
46 changes: 39 additions & 7 deletions src/main/java/com/xenoamess/x8l/X8lTree.java
Original file line number Diff line number Diff line change
@@ -1,25 +1,57 @@
package com.xenoamess.x8l;

import java.io.IOException;
import java.io.Reader;
import java.io.Writer;
import java.io.*;

public class X8lTree {
public boolean debug;
public ContentNode root = null;
public Reader reader;

public static X8lTree GetX8lTree(Reader reader) {
X8lTree res = new X8lTree(reader);
res.parse();
public static X8lTree LoadFromFile(File file) {
X8lTree res = null;
FileReader fileReader = null;
try {
reader.close();
fileReader = new FileReader(file);
res = new X8lTree(fileReader);
res.parse();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
if (fileReader != null) {
fileReader.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
return res;
}

public static void SaveToFile(File file, X8lTree x8lTree) {
FileWriter fileWriter = null;
try {
fileWriter = new FileWriter(file);
x8lTree.output(fileWriter);
fileWriter.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
if (fileWriter != null) {
fileWriter.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
}


public X8lTree(Reader reader) {
this.reader = reader;
}
Expand Down

0 comments on commit 9f691cb

Please sign in to comment.