Class UserMessageSerializer

java.lang.Object
org.bsc.langgraph4j.langchain4j.serializer.std.UserMessageSerializer
All Implemented Interfaces:
Serializer<dev.langchain4j.data.message.UserMessage>, NullableObjectSerializer<dev.langchain4j.data.message.UserMessage>

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

    • UserMessageSerializer

      public UserMessageSerializer()
  • Method Details

    • write

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

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