package cn.citycraft.GsonAgent.nms;

import java.io.Reader;

import cn.citycraft.GsonAgent.api.exception.JsonIOException;
import cn.citycraft.GsonAgent.api.exception.JsonSyntaxException;
import cn.citycraft.GsonAgent.nms.stream.JsonReaderHandle;

public class JsonParserHandle implements cn.citycraft.GsonAgent.api.JsonParser {

	public net.minecraft.util.com.google.gson.JsonParser handle;

	public JsonParserHandle() {
		handle = new net.minecraft.util.com.google.gson.JsonParser();
	}

	protected JsonParserHandle(final net.minecraft.util.com.google.gson.JsonParser handle) {
		this.handle = handle;
	}

	@Override
	public net.minecraft.util.com.google.gson.JsonParser getHandle() {
		return this.handle;
	}

	@Override
	public JsonElementHandle parse(final cn.citycraft.GsonAgent.api.stream.JsonReader json) throws JsonIOException, JsonSyntaxException {
		return new JsonElementHandle(getHandle().parse(((JsonReaderHandle) json).getHandle()));
	}

	@Override
	public JsonElementHandle parse(final Reader json) throws JsonIOException, JsonSyntaxException {
		return new JsonElementHandle(getHandle().parse(json));
	}

	@Override
	public JsonElementHandle parse(final String json) throws JsonSyntaxException {
		return new JsonElementHandle(getHandle().parse(json));
	}

}
