T
- the type to be serializedpublic class AvroSerializationSchema<T> extends Object implements SerializationSchema<T>
SerializationSchema.InitializationContext
Modifier | Constructor and Description |
---|---|
protected |
AvroSerializationSchema(Class<T> recordClazz,
org.apache.avro.Schema schema)
Creates an Avro deserialization schema.
|
Modifier and Type | Method and Description |
---|---|
protected void |
checkAvroInitialized() |
boolean |
equals(Object o) |
static AvroSerializationSchema<org.apache.avro.generic.GenericRecord> |
forGeneric(org.apache.avro.Schema schema)
Creates
AvroSerializationSchema that serializes GenericRecord using provided
schema. |
static <T extends org.apache.avro.specific.SpecificRecord> |
forSpecific(Class<T> tClass)
Creates
AvroSerializationSchema that serializes SpecificRecord using provided
schema. |
protected org.apache.avro.generic.GenericDatumWriter<T> |
getDatumWriter() |
protected org.apache.avro.io.BinaryEncoder |
getEncoder() |
protected ByteArrayOutputStream |
getOutputStream() |
org.apache.avro.Schema |
getSchema() |
int |
hashCode() |
byte[] |
serialize(T object)
Serializes the incoming element to a specified type.
|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
open
protected AvroSerializationSchema(Class<T> recordClazz, @Nullable org.apache.avro.Schema schema)
recordClazz
- class to serialize. Should be one of: SpecificRecord
, GenericRecord
.schema
- writer Avro schema. Should be provided if recordClazz is GenericRecord
public static <T extends org.apache.avro.specific.SpecificRecord> AvroSerializationSchema<T> forSpecific(Class<T> tClass)
AvroSerializationSchema
that serializes SpecificRecord
using provided
schema.tClass
- the type to be serializedpublic static AvroSerializationSchema<org.apache.avro.generic.GenericRecord> forGeneric(org.apache.avro.Schema schema)
AvroSerializationSchema
that serializes GenericRecord
using provided
schema.schema
- the schema that will be used for serializationpublic org.apache.avro.Schema getSchema()
protected org.apache.avro.io.BinaryEncoder getEncoder()
protected org.apache.avro.generic.GenericDatumWriter<T> getDatumWriter()
protected ByteArrayOutputStream getOutputStream()
public byte[] serialize(T object)
SerializationSchema
serialize
in interface SerializationSchema<T>
object
- The incoming element to be serializedprotected void checkAvroInitialized()
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.