Class AbstractMultiVersionReader<T>
- java.lang.Object
-
- org.apache.pulsar.client.impl.schema.reader.AbstractMultiVersionReader<T>
-
- All Implemented Interfaces:
org.apache.pulsar.client.api.schema.SchemaReader<T>
- Direct Known Subclasses:
AbstractMultiVersionAvroBaseReader,MultiVersionGenericProtobufNativeReader
public abstract class AbstractMultiVersionReader<T> extends java.lang.Object implements org.apache.pulsar.client.api.schema.SchemaReader<T>The multi version reader abstract class, implement it will handle the multi version schema.
-
-
Field Summary
Fields Modifier and Type Field Description protected static org.slf4j.LoggerLOGprotected org.apache.pulsar.client.api.schema.SchemaReader<T>providerSchemaReaderprotected org.apache.pulsar.client.api.schema.SchemaInfoProviderschemaInfoProvider
-
Constructor Summary
Constructors Constructor Description AbstractMultiVersionReader(org.apache.pulsar.client.api.schema.SchemaReader<T> providerSchemaReader)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected org.apache.pulsar.common.schema.SchemaInfogetSchemaInfoByVersion(byte[] schemaVersion)TODO: think about how to make this async.org.apache.pulsar.client.api.schema.SchemaReader<T>getSchemaReader(byte[] schemaVersion)protected abstract org.apache.pulsar.client.api.schema.SchemaReader<T>loadReader(org.apache.pulsar.common.protocol.schema.BytesSchemaVersion schemaVersion)Load the schema reader for reading messages encoded by the given schema version.Tread(byte[] bytes, byte[] schemaVersion)Tread(byte[] bytes, int offset, int length)Tread(java.io.InputStream inputStream)Tread(java.io.InputStream inputStream, byte[] schemaVersion)voidsetSchemaInfoProvider(org.apache.pulsar.client.api.schema.SchemaInfoProvider schemaInfoProvider)
-
-
-
Field Detail
-
providerSchemaReader
protected final org.apache.pulsar.client.api.schema.SchemaReader<T> providerSchemaReader
-
schemaInfoProvider
protected org.apache.pulsar.client.api.schema.SchemaInfoProvider schemaInfoProvider
-
LOG
protected static final org.slf4j.Logger LOG
-
-
Constructor Detail
-
AbstractMultiVersionReader
public AbstractMultiVersionReader(org.apache.pulsar.client.api.schema.SchemaReader<T> providerSchemaReader)
-
-
Method Detail
-
read
public T read(byte[] bytes, int offset, int length)
- Specified by:
readin interfaceorg.apache.pulsar.client.api.schema.SchemaReader<T>
-
read
public T read(java.io.InputStream inputStream)
- Specified by:
readin interfaceorg.apache.pulsar.client.api.schema.SchemaReader<T>
-
read
public T read(java.io.InputStream inputStream, byte[] schemaVersion)
- Specified by:
readin interfaceorg.apache.pulsar.client.api.schema.SchemaReader<T>
-
getSchemaReader
public org.apache.pulsar.client.api.schema.SchemaReader<T> getSchemaReader(byte[] schemaVersion) throws java.util.concurrent.ExecutionException
- Throws:
java.util.concurrent.ExecutionException
-
read
public T read(byte[] bytes, byte[] schemaVersion)
- Specified by:
readin interfaceorg.apache.pulsar.client.api.schema.SchemaReader<T>
-
setSchemaInfoProvider
public void setSchemaInfoProvider(org.apache.pulsar.client.api.schema.SchemaInfoProvider schemaInfoProvider)
- Specified by:
setSchemaInfoProviderin interfaceorg.apache.pulsar.client.api.schema.SchemaReader<T>
-
loadReader
protected abstract org.apache.pulsar.client.api.schema.SchemaReader<T> loadReader(org.apache.pulsar.common.protocol.schema.BytesSchemaVersion schemaVersion)
Load the schema reader for reading messages encoded by the given schema version.- Parameters:
schemaVersion- the provided schema version- Returns:
- the schema reader for decoding messages encoded by the provided schema version.
-
getSchemaInfoByVersion
protected org.apache.pulsar.common.schema.SchemaInfo getSchemaInfoByVersion(byte[] schemaVersion)
TODO: think about how to make this async.
-
-