Class JsonPipesIpc

java.lang.Object
org.apache.tika.pipes.core.serialization.JsonPipesIpc

public class JsonPipesIpc extends Object
Binary serialization/deserialization for IPC communication between PipesClient and PipesServer.

Uses Jackson's Smile binary format for efficient serialization. Smile is a binary JSON format that is more compact and faster to parse than text JSON, while maintaining full compatibility with the Jackson data binding API.

  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static <T> T
    fromBytes(byte[] bytes, Class<T> clazz)
    Deserialize Smile binary format bytes to an object.
    static <T> T
    fromBytes(byte[] bytes, Class<T> clazz, boolean trustedRequests)
    As fromBytes(byte[], Class); with trustedRequests a request's parseContext is read as trusted config (pipes.trustedRequests).
    static com.fasterxml.jackson.databind.ObjectMapper
    Get the configured ObjectMapper for direct use if needed.
    static byte[]
    Serialize an object to Smile binary format bytes.
    static void
    Serialize an object to Smile binary format, writing directly into out.

    Methods inherited from class java.lang.Object

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

    • JsonPipesIpc

      public JsonPipesIpc()
  • Method Details

    • toBytes

      public static byte[] toBytes(Object obj) throws IOException
      Serialize an object to Smile binary format bytes.
      Throws:
      IOException
    • toStream

      public static void toStream(Object obj, OutputStream out) throws IOException
      Serialize an object to Smile binary format, writing directly into out. Any IOException thrown by out (e.g. from a size-capped stream) propagates unchanged, letting callers distinguish payload-limit aborts from genuine I/O errors.
      Throws:
      IOException
    • fromBytes

      public static <T> T fromBytes(byte[] bytes, Class<T> clazz) throws IOException
      Deserialize Smile binary format bytes to an object.
      Throws:
      IOException
    • fromBytes

      public static <T> T fromBytes(byte[] bytes, Class<T> clazz, boolean trustedRequests) throws IOException
      As fromBytes(byte[], Class); with trustedRequests a request's parseContext is read as trusted config (pipes.trustedRequests).
      Throws:
      IOException
    • getMapper

      public static com.fasterxml.jackson.databind.ObjectMapper getMapper()
      Get the configured ObjectMapper for direct use if needed.