Class ByteBufferSchema

  • All Implemented Interfaces:
    java.lang.Cloneable, org.apache.pulsar.client.api.Schema<java.nio.ByteBuffer>

    public class ByteBufferSchema
    extends AbstractSchema<java.nio.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
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.nio.ByteBuffer decode​(byte[] data)  
      java.nio.ByteBuffer decode​(io.netty.buffer.ByteBuf byteBuffer)
      Decode a byteBuf into an object using the schema definition and deserializer implementation
      java.nio.ByteBuffer decode​(java.nio.ByteBuffer byteBuffer, byte[] schemaVersion)  
      byte[] encode​(java.nio.ByteBuffer data)  
      org.apache.pulsar.common.schema.SchemaInfo getSchemaInfo()  
      static ByteBufferSchema of()  
      • 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, getNativeSchema, requireFetchingSchemaInfo, setSchemaInfoProvider, supportSchemaVersioning, validate
    • Constructor Detail

      • ByteBufferSchema

        public ByteBufferSchema()
    • Method Detail

      • encode

        public byte[] encode​(java.nio.ByteBuffer data)
      • decode

        public java.nio.ByteBuffer decode​(byte[] data)
      • decode

        public java.nio.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<java.nio.ByteBuffer>
        Parameters:
        byteBuffer - the byte buffer to decode
        Returns:
        the deserialized object
      • decode

        public java.nio.ByteBuffer decode​(java.nio.ByteBuffer byteBuffer,
                                          byte[] schemaVersion)
      • getSchemaInfo

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