Class MetadataParser


  • public final class MetadataParser
    extends Object
    • Method Detail

      • gsonBuilder

        public static com.google.gson.GsonBuilder gsonBuilder()
      • read

        public static MetadataContainer read​(Path path,
                                             com.google.gson.Gson gson)
                                      throws IOException
        Reads a container from a given path with configured deserializer.

        To get a standard deserializer, gsonBuilder() is available.

        Parameters:
        path - The path
        gson - The deserializer
        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 a container from a given reader with configured deserializer.

        To get a standard deserializer, gsonBuilder() is available.

        Parameters:
        reader - The reader
        gson - 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 a container to the given path using the configured serializer.

        To get a standard serializer, gsonBuilder() is available.

        Parameters:
        path - The path
        container - The container
        gson - The serializer
        indent - 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 a container to the given path using the configured serializer.

        To get a standard serializer, gsonBuilder() is available.

        Parameters:
        writer - The writer
        container - The container
        gson - The serializer
        indent - True to indent (pretty print) the resulting JSON, false if not
        Throws:
        IOException - If the container fails to serialize