blob: 05a98fefcc71edc565b235c7c3ff5b4c32d1ff9a [file] [log] [blame] [raw]
package net.querz.nbt.io;
import net.querz.io.StringDeserializer;
import net.querz.nbt.tag.Tag;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.Reader;
import java.util.stream.Collectors;
public class SNBTDeserializer implements StringDeserializer<Tag<?>> {
@Override
public Tag<?> fromReader(Reader reader) throws IOException {
return fromReader(reader, Tag.DEFAULT_MAX_DEPTH);
}
public Tag<?> fromReader(Reader reader, int maxDepth) throws IOException {
BufferedReader bufferedReader;
if (reader instanceof BufferedReader) {
bufferedReader = (BufferedReader) reader;
} else {
bufferedReader = new BufferedReader(reader);
}
return SNBTParser.parse(bufferedReader.lines().collect(Collectors.joining()), maxDepth);
}
}