Class JsonMetadataList

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

public class JsonMetadataList extends Object
  • 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 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(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 write
      writer - writer
      prettyPrint - whether or not to pretty print the output
      Throws:
      TikaException - if there is an IOException during writing
      IOException
    • toJson

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

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