Class AiMessageSerializer

java.lang.Object
org.bsc.langgraph4j.langchain4j.serializer.std.AiMessageSerializer
All Implemented Interfaces:
Serializer<dev.langchain4j.data.message.AiMessage>

public class AiMessageSerializer extends Object implements Serializer<dev.langchain4j.data.message.AiMessage>
The AiMessageSerializer class implements the Serializer interface for the AiMessage type. It provides methods to serialize and deserialize AiMessage objects.
  • Constructor Details

    • AiMessageSerializer

      public AiMessageSerializer()
  • Method Details

    • write

      public void write(dev.langchain4j.data.message.AiMessage object, ObjectOutput out) throws IOException
      Serializes the given AiMessage object to the specified output stream.
      Specified by:
      write in interface Serializer<dev.langchain4j.data.message.AiMessage>
      Parameters:
      object - the AiMessage object to serialize
      out - the output stream to write the serialized object to
      Throws:
      IOException - if an I/O error occurs during serialization
    • read

      public dev.langchain4j.data.message.AiMessage read(ObjectInput in) throws IOException, ClassNotFoundException
      Deserializes an AiMessage object from the specified input stream.
      Specified by:
      read in interface Serializer<dev.langchain4j.data.message.AiMessage>
      Parameters:
      in - the input stream to read the serialized object from
      Returns:
      the deserialized AiMessage object
      Throws:
      IOException - if an I/O error occurs during deserialization
      ClassNotFoundException - if the class of a serialized object cannot be found