Class StringSchema

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

public class StringSchema extends AbstractSchema<String>
Schema definition for Strings encoded in UTF-8 format.
  • Constructor Details

    • StringSchema

      public StringSchema()
    • StringSchema

      public StringSchema(Charset charset)
  • Method Details

    • fromSchemaInfo

      public static StringSchema fromSchemaInfo(SchemaInfo schemaInfo)
    • utf8

      public static StringSchema utf8()
    • encode

      public byte[] encode(String message)
    • decode

      public String decode(byte[] bytes)
    • decode

      public String decode(io.netty.buffer.ByteBuf byteBuf)
      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<String>
      Parameters:
      byteBuf - the byte buffer to decode
      Returns:
      the deserialized object
    • getSchemaInfo

      public SchemaInfo getSchemaInfo()