Package org.apache.tika.serialization
Class JsonMetadataList
java.lang.Object
org.apache.tika.serialization.JsonMetadataList
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionRead metadata from reader.static com.fasterxml.jackson.core.StreamReadConstraintsGets the current stream read constraints.static voidsetPrettyPrinting(boolean prettyPrint) static voidsetStreamReadConstraints(com.fasterxml.jackson.core.StreamReadConstraints constraints) Sets the stream read constraints for JSON parsing of metadata lists.static voidSerializes a Metadata object to Json.static voidSerializes a Metadata object to Json.
-
Constructor Details
-
JsonMetadataList
public JsonMetadataList()
-
-
Method Details
-
setStreamReadConstraints
public static void setStreamReadConstraints(com.fasterxml.jackson.core.StreamReadConstraints constraints) Sets the stream read constraints for JSON parsing of metadata lists. This affects all subsequent calls tofromJson(Reader).Typically called by TikaLoader during initialization based on the "metadata-list" configuration section.
- Parameters:
constraints- the constraints to use
-
getStreamReadConstraints
public static com.fasterxml.jackson.core.StreamReadConstraints getStreamReadConstraints()Gets the current stream read constraints.- Returns:
- the current constraints
-
toJson
public static void toJson(List<Metadata> metadataList, Writer writer, boolean prettyPrint) throws IOException Serializes a Metadata object to Json. This does not flush or close the writer.- Parameters:
metadataList- list of metadata to writewriter- writerprettyPrint- whether or not to pretty print the output- Throws:
TikaException- if there is an IOException during writingIOException
-
toJson
Serializes a Metadata object to Json. This does not flush or close the writer.- Parameters:
metadataList- list of metadata to writewriter- writer- Throws:
TikaException- if there is an IOException during writingIOException
-
fromJson
Read metadata from reader. This does not close the reader.- Parameters:
reader- the reader to read from- Returns:
- Metadata list or null if reader is null
- Throws:
IOException- in case of parse failure or IO failure with Reader
-
setPrettyPrinting
public static void setPrettyPrinting(boolean prettyPrint)
-