Class JsonMetadata
- java.lang.Object
-
- org.apache.tika.metadata.serialization.JsonMetadataBase
-
- org.apache.tika.metadata.serialization.JsonMetadata
-
public class JsonMetadata extends JsonMetadataBase
-
-
Constructor Summary
Constructors Constructor Description JsonMetadata()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Metadata
fromJson(Reader reader)
Read metadata from reader.static void
setGson(com.google.gson.Gson gson)
Enables setting custom configurations on Gson.static void
setPrettyPrinting(boolean prettyPrint)
static void
toJson(Metadata metadata, Writer writer)
Serializes a Metadata object to Json.
-
-
-
Method Detail
-
toJson
public static void toJson(Metadata metadata, Writer writer) throws TikaException
Serializes a Metadata object to Json. This does not flush or close the writer.- Parameters:
metadata
- metadata to writewriter
- writer- Throws:
TikaException
- if there is an IOException during writing
-
fromJson
public static Metadata fromJson(Reader reader) throws TikaException
Read metadata from reader.- Parameters:
reader
- reader to read from- Returns:
- Metadata or null if nothing could be read from the reader
- Throws:
TikaException
- in case of parse failure by Gson or IO failure with Reader
-
setGson
public static void setGson(com.google.gson.Gson 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.- Parameters:
gson
-
-
setPrettyPrinting
public static void setPrettyPrinting(boolean prettyPrint)
-
-