From 62ad6505371582769a0d91cd3c18c40080063c32 Mon Sep 17 00:00:00 2001 From: Selebrator Date: Tue, 4 Jun 2019 11:21:06 +0200 Subject: [PATCH] More documentation --- src/main/java/_8/Lecture.java | 12 ++++++++++++ src/main/java/_8/io/SonReader.java | 6 ++++++ 2 files changed, 18 insertions(+) diff --git a/src/main/java/_8/Lecture.java b/src/main/java/_8/Lecture.java index 2466d61..72cebf4 100644 --- a/src/main/java/_8/Lecture.java +++ b/src/main/java/_8/Lecture.java @@ -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 data = Files.readAllLines(file); diff --git a/src/main/java/_8/io/SonReader.java b/src/main/java/_8/io/SonReader.java index 9191795..6fc3c89 100644 --- a/src/main/java/_8/io/SonReader.java +++ b/src/main/java/_8/io/SonReader.java @@ -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;