Class JsonMetadataList

    • Constructor Detail

      • JsonMetadataList

        public JsonMetadataList()
    • Method Detail

      • toJson

        public static void toJson​(List<Metadata> metadataList,
                                  Writer writer)
                           throws TikaException
        Serializes a Metadata object to Json. This does not flush or close the writer.
        metadataList - list of metadata to write
        writer - writer
        TikaException - if there is an IOException during writing
      • fromJson

        public static List<Metadata> fromJson​(Reader reader)
                                       throws TikaException
        Read metadata from reader.
        reader -
        Metadata or null if nothing could be read from the reader
        TikaException - in case of parse failure by Gson or IO failure with Reader
      • setGson

        public static void setGson​( gson)
        Enables setting custom configurations on Gson. Remember to register a serializer and a deserializer for Metadata. This does a literal set and does not add the default serializer and deserializers.
        gson -
      • setPrettyPrinting

        public static void setPrettyPrinting​(boolean prettyPrint)