Package org.apache.tika.serialization
Class JsonMetadata
java.lang.Object
org.apache.tika.serialization.JsonMetadata
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic MetadataRead 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.static voidSerializes a Metadata object to Json.
-
Constructor Details
-
JsonMetadata
public JsonMetadata()
-
-
Method Details
-
setStreamReadConstraints
public static void setStreamReadConstraints(com.fasterxml.jackson.core.StreamReadConstraints constraints) Sets the stream read constraints for JSON parsing of metadata. 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
Serializes a Metadata object to Json. This does not flush or close the writer.- Parameters:
metadata- metadata to writewriter- writer- Throws:
IOException- if there is an IOException during writing
-
fromJson
Read metadata from reader. This does not close the reader.- Parameters:
reader- reader to read from- Returns:
- Metadata 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)
-