Class MetadataParser
- java.lang.Object
-
- org.spongepowered.plugin.metadata.builtin.MetadataParser
-
public final class MetadataParser extends Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static com.google.gson.GsonBuildergsonBuilder()static MetadataContainerread(Reader reader)Reads acontainerfrom a givenreaderusing the defaultdeserializer(retrieved fromgsonBuilder()).static MetadataContainerread(Reader reader, com.google.gson.Gson gson)static MetadataContainerread(Path path)static MetadataContainerread(Path path, com.google.gson.Gson gson)static voidwrite(Writer writer, MetadataContainer container, com.google.gson.Gson gson, boolean indent)static voidwrite(Path path, MetadataContainer container, com.google.gson.Gson gson, boolean indent)
-
-
-
Method Detail
-
gsonBuilder
public static com.google.gson.GsonBuilder gsonBuilder()
-
read
public static MetadataContainer read(Path path) throws IOException
- Parameters:
path- The path- Returns:
- The container
- Throws:
IOException- if the container fails to be read
-
read
public static MetadataContainer read(Path path, com.google.gson.Gson gson) throws IOException
Reads acontainerfrom a givenpathwith configureddeserializer.To get a standard deserializer,
gsonBuilder()is available.- Parameters:
path- The pathgson- The deserializer- Returns:
- The container
- Throws:
IOException- if the container fails to be read
-
read
public static MetadataContainer read(Reader reader) throws IOException
Reads acontainerfrom a givenreaderusing the defaultdeserializer(retrieved fromgsonBuilder()).- Parameters:
reader- The reader- Returns:
- The container
- Throws:
IOException- if the container fails to be read
-
read
public static MetadataContainer read(Reader reader, com.google.gson.Gson gson) throws IOException
Reads acontainerfrom a givenreaderwith configureddeserializer.To get a standard deserializer,
gsonBuilder()is available.- Parameters:
reader- The readergson- The deserializer- Returns:
- The container
- Throws:
IOException- if the container fails to deserialize
-
write
public static void write(Path path, MetadataContainer container, com.google.gson.Gson gson, boolean indent) throws IOException
Writes acontainerto the givenpathusing the configuredserializer.To get a standard serializer,
gsonBuilder()is available.- Parameters:
path- The pathcontainer- The containergson- The serializerindent- True to indent (pretty print) the resulting JSON, false if not- Throws:
IOException- If the container fails to serialize
-
write
public static void write(Writer writer, MetadataContainer container, com.google.gson.Gson gson, boolean indent) throws IOException
Writes acontainerto the givenpathusing the configuredserializer.To get a standard serializer,
gsonBuilder()is available.- Parameters:
writer- The writercontainer- The containergson- The serializerindent- True to indent (pretty print) the resulting JSON, false if not- Throws:
IOException- If the container fails to serialize
-
-