Class ByteBufferSchema

java.lang.Object
org.apache.pulsar.client.impl.schema.AbstractSchema<ByteBuffer>
org.apache.pulsar.client.impl.schema.ByteBufferSchema
All Implemented Interfaces:
Cloneable, org.apache.pulsar.client.api.Schema<ByteBuffer>

public class ByteBufferSchema extends AbstractSchema<ByteBuffer>
A bytebuffer schema is effectively a `BYTES` schema.
  • Field Summary

    Fields inherited from interface org.apache.pulsar.client.api.Schema

    BOOL, BYTEBUFFER, BYTES, DATE, DOUBLE, FLOAT, INSTANT, INT16, INT32, INT64, INT8, LOCAL_DATE, LOCAL_DATE_TIME, LOCAL_TIME, STRING, TIME, TIMESTAMP
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    decode(byte[] data)
     
    decode(io.netty.buffer.ByteBuf byteBuffer)
    Decode a byteBuf into an object using the schema definition and deserializer implementation
    decode(ByteBuffer byteBuffer, byte[] schemaVersion)
     
    byte[]
     
    org.apache.pulsar.common.schema.SchemaInfo
     
    of()
     

    Methods inherited from class org.apache.pulsar.client.impl.schema.AbstractSchema

    atSchemaVersion, clone, decode

    Methods inherited from class java.lang.Object

    equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.apache.pulsar.client.api.Schema

    configureSchemaInfo, decode, decode, getNativeSchema, requireFetchingSchemaInfo, setSchemaInfoProvider, supportSchemaVersioning, validate
  • Constructor Details

    • ByteBufferSchema

      public ByteBufferSchema()
  • Method Details

    • of

      public static ByteBufferSchema of()
    • encode

      public byte[] encode(ByteBuffer data)
    • decode

      public ByteBuffer decode(byte[] data)
    • decode

      public ByteBuffer decode(io.netty.buffer.ByteBuf byteBuffer)
      Description copied from class: AbstractSchema
      Decode a byteBuf into an object using the schema definition and deserializer implementation

      Do not modify reader/writer index of ByteBuf so, it can be reused to access correct data.

      Specified by:
      decode in class AbstractSchema<ByteBuffer>
      Parameters:
      byteBuffer - the byte buffer to decode
      Returns:
      the deserialized object
    • decode

      public ByteBuffer decode(ByteBuffer byteBuffer, byte[] schemaVersion)
    • getSchemaInfo

      public org.apache.pulsar.common.schema.SchemaInfo getSchemaInfo()