More documentation

master 8
Selebrator 7 years ago
parent edd30cb537
commit 62ad650537

@ -184,6 +184,18 @@ public class Lecture {
Files.write(file, lines);
}
/*
* Bitte um Feedback, untere lösung (loadText2)
* macht weniger Annahmen.
*
* Zeilenumbrüche zwischen name-value Paaren.
* Whitespace weglassen macht probleme. Ist kompatibel mit
* dem outout von saveText.
* Nur eine Lecture pro Datei.
*
*
*
*/
public static Lecture loadText(String filename) throws IOException {
Path file = Paths.get(filename);
List<String> data = Files.readAllLines(file);

@ -56,6 +56,7 @@ public class SonReader implements Closeable {
}
}
/* true untill the current inner most array or object is out of elements */
public boolean hasNext() throws IOException {
int c = this.nextNonWhitespace();
this.rememberChar(c);
@ -93,6 +94,7 @@ public class SonReader implements Closeable {
return name.toString().trim();
}
/* put the reder in a state where it can accept a name */
private void prepareName() throws IOException {
SonState state = this.peekState();
if(state == NONEMPTY_OBJECT) { // not first in an object
@ -104,6 +106,8 @@ public class SonReader implements Closeable {
this.replaceTopState(DANGLING_NAME);
}
/* put the reder in a state where it can accept a value
*/
private void prepareValue() throws IOException {
SonState state = this.peekState();
switch(state) {
@ -136,6 +140,8 @@ public class SonReader implements Closeable {
return value.toString().trim();
}
/* should recursively skip a value */
//TODO funktioniert nicht so wie es soll
public void skipValue() throws IOException {
this.prepareValue();
int count = 0;

Loading…
Cancel
Save