Interface SchemaReader<T>


  • @Public
    @Stable
    public interface SchemaReader<T>
    Deserialize messages from bytes.
    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      default java.util.Optional<java.lang.Object> getNativeSchema()
      Returns the underling Schema if possible
      default T read​(byte[] bytes)
      Serialize bytes convert pojo.
      default T read​(byte[] bytes, byte[] schemaVersion)
      Serialize bytes convert pojo.
      T read​(byte[] bytes, int offset, int length)
      serialize bytes convert pojo.
      T read​(java.io.InputStream inputStream)
      serialize bytes convert pojo.
      default T read​(java.io.InputStream inputStream, byte[] schemaVersion)
      serialize bytes convert pojo.
      default void setSchemaInfoProvider​(SchemaInfoProvider schemaInfoProvider)
      Set schema info provider, this method support multi version reader.
    • Method Detail

      • read

        default T read​(byte[] bytes)
        Serialize bytes convert pojo.
        Parameters:
        bytes - the data
        Returns:
        the serialized object
      • read

        T read​(byte[] bytes,
               int offset,
               int length)
        serialize bytes convert pojo.
        Parameters:
        bytes - the data
        offset - the byte[] initial position
        length - the byte[] read length
        Returns:
        the serialized object
      • read

        T read​(java.io.InputStream inputStream)
        serialize bytes convert pojo.
        Parameters:
        inputStream - the stream of message
        Returns:
        the serialized object
      • read

        default T read​(byte[] bytes,
                       byte[] schemaVersion)
        Serialize bytes convert pojo.
        Parameters:
        bytes - the data
        schemaVersion - the schema version of message
        Returns:
        the serialized object
      • read

        default T read​(java.io.InputStream inputStream,
                       byte[] schemaVersion)
        serialize bytes convert pojo.
        Parameters:
        inputStream - the stream of message
        schemaVersion - the schema version of message
        Returns:
        the serialized object
      • setSchemaInfoProvider

        default void setSchemaInfoProvider​(SchemaInfoProvider schemaInfoProvider)
        Set schema info provider, this method support multi version reader.
        Parameters:
        schemaInfoProvider - the stream of message
      • getNativeSchema

        default java.util.Optional<java.lang.Object> getNativeSchema()
        Returns the underling Schema if possible
        Returns:
        the schema, or an empty Optional if it is not possible to access it