Interface Codecs

All Known Implementing Classes:
DefaultCodecs

public interface Codecs
Encodes and decodes objects.
  • Method Summary

    Modifier and Type
    Method
    Description
    <T> @Nullable T
    decode(@Nullable io.netty.buffer.ByteBuf buffer, int dataType, io.r2dbc.postgresql.message.Format format, Class<? extends T> type)
    Decode a data to a value.
    io.r2dbc.postgresql.client.EncodedParameter
    encode(Object value)
    Encode a value.
    io.r2dbc.postgresql.client.EncodedParameter
    encodeNull(Class<?> type)
    Encode a null value.
    @Nullable Class<?>
    preferredType(int dataType, io.r2dbc.postgresql.message.Format format)
    Returns the preferred Java type for a given data type and format.
  • Method Details

    • decode

      <T> @Nullable T decode(@Nullable io.netty.buffer.ByteBuf buffer, int dataType, io.r2dbc.postgresql.message.Format format, Class<? extends T> type)
      Decode a data to a value.
      Type Parameters:
      T - the type of item being returned
      Parameters:
      buffer - the ByteBuf to decode
      dataType - the data type of the data
      format - the format of the data
      type - the type to decode to
      Returns:
      the decoded value
      Throws:
      IllegalArgumentException - if format or type is null
    • encode

      io.r2dbc.postgresql.client.EncodedParameter encode(Object value)
      Encode a value.
      Parameters:
      value - the value to encode
      Returns:
      the encoded value
      Throws:
      IllegalArgumentException - if value is null
    • encodeNull

      io.r2dbc.postgresql.client.EncodedParameter encodeNull(Class<?> type)
      Encode a null value.
      Parameters:
      type - the type to encode
      Returns:
      the encoded value
      Throws:
      IllegalArgumentException - if type is null
    • preferredType

      @Nullable Class<?> preferredType(int dataType, io.r2dbc.postgresql.message.Format format)
      Returns the preferred Java type for a given data type and format.
      Parameters:
      dataType - the data type fo the data
      format - the format of the data
      Returns:
      the preferred Java type for a given data type and format
      Throws:
      IllegalArgumentException - if format is null