Module bus.http

Interface Convertor

All Known Implementing Classes:
Convertor.FormConvertor

public interface Convertor
An interface for message conversion, handling serialization and deserialization of objects to and from different data formats.
Since:
Java 17+
Author:
Kimi Liu
  • Method Details

    • contentType

      String contentType()
      Returns the media type of the messages handled by this converter.
      Returns:
      The media type string.
    • toMapper

      CoverWapper toMapper(InputStream in, Charset charset)
      Parses an input stream into a CoverWapper.
      Parameters:
      in - The input stream.
      charset - The character set.
      Returns:
      A CoverWapper instance.
    • toArray

      CoverArray toArray(InputStream in, Charset charset)
      Parses an input stream into a CoverArray.
      Parameters:
      in - The input stream.
      charset - The character set.
      Returns:
      A CoverArray instance.
    • serialize

      byte[] serialize(Object object, Charset charset)
      Serializes a Java object into a byte array.
      Parameters:
      object - The Java object.
      charset - The character set.
      Returns:
      A byte array.
    • serialize

      byte[] serialize(Object object, String dateFormat, Charset charset)
      Serializes a Java object into a byte array with a specified date format.
      Parameters:
      object - The Java object.
      dateFormat - The date format string.
      charset - The character set.
      Returns:
      A byte array.
    • toBean

      <T> T toBean(Class<T> type, InputStream in, Charset charset)
      Parses an input stream into a Java bean of the specified type.
      Type Parameters:
      T - The target generic type.
      Parameters:
      type - The target class type.
      in - The input stream.
      charset - The character set.
      Returns:
      A Java bean instance.
    • toList

      <T> List<T> toList(Class<T> type, InputStream in, Charset charset)
      Parses an input stream into a list of Java objects of the specified type.
      Type Parameters:
      T - The target generic type.
      Parameters:
      type - The target class type.
      in - The input stream.
      charset - The character set.
      Returns:
      A list of Java objects.