Class JsonMetadata

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

public class JsonMetadata extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static org.apache.tika.metadata.Metadata
    fromJson(Reader reader)
    Read metadata from reader.
    static org.apache.tika.metadata.Metadata
    readMetadataObject(com.fasterxml.jackson.core.JsonParser jParser)
    expects that jParser has not yet started on object or for jParser to be pointing to the start object.
    static void
    setPrettyPrinting(boolean prettyPrint)
     
    static void
    toJson(org.apache.tika.metadata.Metadata metadata, Writer writer)
    Serializes a Metadata object to Json.
    static void
    writeMetadataObject(org.apache.tika.metadata.Metadata metadata, com.fasterxml.jackson.core.JsonGenerator jsonGenerator, boolean prettyPrint)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • JsonMetadata

      public JsonMetadata()
  • Method Details

    • toJson

      public static void toJson(org.apache.tika.metadata.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
    • writeMetadataObject

      public static void writeMetadataObject(org.apache.tika.metadata.Metadata metadata, com.fasterxml.jackson.core.JsonGenerator jsonGenerator, boolean prettyPrint) throws IOException
      Throws:
      IOException
    • fromJson

      public static org.apache.tika.metadata.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 nothing could be read from the reader
      Throws:
      IOException - in case of parse failure or IO failure with Reader
    • readMetadataObject

      public static org.apache.tika.metadata.Metadata readMetadataObject(com.fasterxml.jackson.core.JsonParser jParser) throws IOException
      expects that jParser has not yet started on object or for jParser to be pointing to the start object.
      Parameters:
      jParser -
      Returns:
      Throws:
      IOException
    • setPrettyPrinting

      public static void setPrettyPrinting(boolean prettyPrint)