Class JsonMetadata

java.lang.Object
org.apache.tika.serialization.JsonMetadata

public class JsonMetadata extends Object
  • 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 to fromJson(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(Metadata metadata, Writer writer) throws IOException
      Serializes a Metadata object to Json. This does not flush or close the writer.
      Parameters:
      metadata - metadata to write
      writer - writer
      Throws:
      IOException - if there is an IOException during writing
    • fromJson

      public static Metadata fromJson(Reader reader) throws IOException
      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)