Class StringSchema
- java.lang.Object
-
- org.apache.pulsar.client.impl.schema.AbstractSchema<java.lang.String>
-
- org.apache.pulsar.client.impl.schema.StringSchema
-
- All Implemented Interfaces:
java.lang.Cloneable,org.apache.pulsar.client.api.Schema<java.lang.String>
public class StringSchema extends AbstractSchema<java.lang.String>
Schema definition for Strings encoded in UTF-8 format.
-
-
Constructor Summary
Constructors Constructor Description StringSchema()StringSchema(java.nio.charset.Charset charset)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Stringdecode(byte[] bytes)java.lang.Stringdecode(io.netty.buffer.ByteBuf byteBuf)Decode a byteBuf into an object using the schema definition and deserializer implementationbyte[]encode(java.lang.String message)static StringSchemafromSchemaInfo(org.apache.pulsar.common.schema.SchemaInfo schemaInfo)org.apache.pulsar.common.schema.SchemaInfogetSchemaInfo()static StringSchemautf8()-
Methods inherited from class org.apache.pulsar.client.impl.schema.AbstractSchema
atSchemaVersion, clone, decode
-
-
-
-
Method Detail
-
fromSchemaInfo
public static StringSchema fromSchemaInfo(org.apache.pulsar.common.schema.SchemaInfo schemaInfo)
-
utf8
public static StringSchema utf8()
-
encode
public byte[] encode(java.lang.String message)
-
decode
public java.lang.String decode(byte[] bytes)
-
decode
public java.lang.String decode(io.netty.buffer.ByteBuf byteBuf)
Description copied from class:AbstractSchemaDecode a byteBuf into an object using the schema definition and deserializer implementationDo not modify reader/writer index of ByteBuf so, it can be reused to access correct data.
- Specified by:
decodein classAbstractSchema<java.lang.String>- Parameters:
byteBuf- the byte buffer to decode- Returns:
- the deserialized object
-
getSchemaInfo
public org.apache.pulsar.common.schema.SchemaInfo getSchemaInfo()
-
-