Class JsonReader
java.lang.Object
de.linusdev.data.parser.JsonReader
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()voidpushBack(int i) Pushes given character back, so the nextread(ParseTracker)call will read it.
The push back buffer supports only a single character, if the buffer is not empty, it will be overwritten, and the old character will be lost.intread(@NotNull de.linusdev.lutils.other.parser.ParseTracker tracker) reads to the next character, which integer value is not below 33.@NotNull StringreadMultiLineComment(@NotNull de.linusdev.lutils.other.parser.ParseTracker tracker) intreadNextChar(@NotNull de.linusdev.lutils.other.parser.ParseTracker tracker) Reads the next char without skipping anythingreadString(boolean allowNewLine, @NotNull de.linusdev.lutils.other.parser.ParseTracker tracker) reads until a '"' is read.@NotNull StringreadToEOL(@NotNull de.linusdev.lutils.other.parser.ParseTracker tracker) Reads until EOL or EOF.@Nullable ObjectreadValue(@NotNull de.linusdev.lutils.other.parser.ParseTracker tracker, boolean allowToken)
-
Constructor Details
-
JsonReader
-
-
Method Details
-
pushBack
public void pushBack(int i) Pushes given character back, so the nextread(ParseTracker)call will read it.
The push back buffer supports only a single character, if the buffer is not empty, it will be overwritten, and the old character will be lost.- Parameters:
i- character to push back
-
read
public int read(@NotNull @NotNull de.linusdev.lutils.other.parser.ParseTracker tracker) throws IOException reads to the next character, which integer value is not below 33.- Returns:
- next character or -1 if end of the stream is reached.
- Throws:
IOException
-
readNextChar
public int readNextChar(@NotNull @NotNull de.linusdev.lutils.other.parser.ParseTracker tracker) throws IOException Reads the next char without skipping anything- Parameters:
tracker- to track lines- Returns:
- the next char or -1 if the end has been reached.
- Throws:
IOException- while reading
-
readToEOL
@NotNull public @NotNull String readToEOL(@NotNull @NotNull de.linusdev.lutils.other.parser.ParseTracker tracker) throws IOException Reads until EOL or EOF.- Parameters:
tracker-ParseTracker- Returns:
- read value, may be
Boolean,nullorNumber - Throws:
IOException- while reading or parsing
-
readMultiLineComment
@NotNull public @NotNull String readMultiLineComment(@NotNull @NotNull de.linusdev.lutils.other.parser.ParseTracker tracker) throws IOException, de.linusdev.lutils.other.parser.UnexpectedEndException - Throws:
IOExceptionde.linusdev.lutils.other.parser.UnexpectedEndException
-
readValue
@Nullable public @Nullable Object readValue(@NotNull @NotNull de.linusdev.lutils.other.parser.ParseTracker tracker, boolean allowToken) throws IOException, de.linusdev.lutils.other.parser.ParseException - Parameters:
tracker-ParseTrackerallowToken- whetherJsonParser.setIdentifyNumberValues(boolean)is set totrue.- Returns:
- read value, may be
Boolean,nullorNumber - Throws:
IOException- while reading or parsingde.linusdev.lutils.other.parser.ParseException- while reading or parsing
-
readString
public String readString(boolean allowNewLine, @NotNull @NotNull de.linusdev.lutils.other.parser.ParseTracker tracker) throws IOException, de.linusdev.lutils.other.parser.ParseException reads until a '"' is read.- Parameters:
allowNewLine- whether to allow a line break while readingtracker-ParseTracker- Returns:
- read
String - Throws:
IOException- while reading or parsingde.linusdev.lutils.other.parser.ParseException- while reading or parsing
-
close
public void close()
-