Class NativeAvroBytesSchema<T>
- java.lang.Object
-
- org.apache.pulsar.client.impl.schema.NativeAvroBytesSchema<T>
-
- All Implemented Interfaces:
java.lang.Cloneable,org.apache.pulsar.client.api.Schema<byte[]>
public class NativeAvroBytesSchema<T> extends java.lang.Object implements org.apache.pulsar.client.api.Schema<byte[]>Schema from a native Apache Avro schema. This class is supposed to be used on the producer side for working with existing data serialized in Avro, possibly stored in another system like Kafka. For this reason, it will not perform bytes validation against the schema in encoding and decoding, which are just identify functions. This class also makes it possible for users to bring in their own Avro serialization method.
-
-
Constructor Summary
Constructors Constructor Description NativeAvroBytesSchema(java.lang.Object schema)NativeAvroBytesSchema(org.apache.avro.Schema schema)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.apache.pulsar.client.api.Schema<byte[]>clone()byte[]decode(byte[] bytes, byte[] schemaVersion)byte[]encode(byte[] message)java.util.Optional<java.lang.Object>getNativeSchema()org.apache.pulsar.common.schema.SchemaInfogetSchemaInfo()booleanschemaInitialized()voidsetSchema(org.apache.avro.Schema schema)
-
-
-
Method Detail
-
setSchema
public void setSchema(org.apache.avro.Schema schema)
-
schemaInitialized
public boolean schemaInitialized()
-
encode
public byte[] encode(byte[] message)
- Specified by:
encodein interfaceorg.apache.pulsar.client.api.Schema<T>
-
decode
public byte[] decode(byte[] bytes, byte[] schemaVersion)- Specified by:
decodein interfaceorg.apache.pulsar.client.api.Schema<T>
-
getSchemaInfo
public org.apache.pulsar.common.schema.SchemaInfo getSchemaInfo()
- Specified by:
getSchemaInfoin interfaceorg.apache.pulsar.client.api.Schema<T>
-
getNativeSchema
public java.util.Optional<java.lang.Object> getNativeSchema()
- Specified by:
getNativeSchemain interfaceorg.apache.pulsar.client.api.Schema<T>
-
clone
public org.apache.pulsar.client.api.Schema<byte[]> clone()
- Specified by:
clonein interfaceorg.apache.pulsar.client.api.Schema<T>- Overrides:
clonein classjava.lang.Object
-
-