Class GlueSchemaRegistryDeserializerDataParser
- java.lang.Object
-
- com.amazonaws.services.schemaregistry.deserializers.GlueSchemaRegistryDeserializerDataParser
-
public final class GlueSchemaRegistryDeserializerDataParser extends Object
Parser that understands the schema registry data format and extracts schema id from serialized data, also performs data integrity validations.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description BytegetCompressionByte(ByteBuffer byteBuffer)Get the compression byte.BytegetHeaderVersionByte(ByteBuffer byteBuffer)Get the header version byte.static GlueSchemaRegistryDeserializerDataParsergetInstance()Singleton instantiation helper.byte[]getPlainData(ByteBuffer byteBuffer)UUIDgetSchemaVersionId(ByteBuffer byteBuffer)Gets the schema version id embedded within the data.booleanisCompressionEnabled(ByteBuffer byteBuffer)Is Compression enabledbooleanisDataCompatible(ByteBuffer byteBuffer, StringBuilder errorBuilder)Validates the data for compatibility with schema registry.
-
-
-
Method Detail
-
getInstance
public static GlueSchemaRegistryDeserializerDataParser getInstance()
Singleton instantiation helper.- Returns:
- returns a singleton instance for GlueSchemaRegistryDeserializerDataParser
-
getSchemaVersionId
public UUID getSchemaVersionId(ByteBuffer byteBuffer)
Gets the schema version id embedded within the data.- Parameters:
byteBuffer- data from where schema version id has to be extracted as ByteBuffer- Returns:
- schema UUID
- Throws:
GlueSchemaRegistryIncompatibleDataException- when the data is incompatible with schema registry
-
isDataCompatible
public boolean isDataCompatible(ByteBuffer byteBuffer, StringBuilder errorBuilder)
Validates the data for compatibility with schema registry.- Parameters:
byteBuffer- input data as byte buffererrorBuilder- error message for the validation that can be used by the caller- Returns:
- true - validation success; false - otherwise
-
getPlainData
public byte[] getPlainData(ByteBuffer byteBuffer)
-
isCompressionEnabled
public boolean isCompressionEnabled(ByteBuffer byteBuffer)
Is Compression enabled- Parameters:
byteBuffer- byte buffer- Returns:
- whether the byte buffer has been compressed
-
getCompressionByte
public Byte getCompressionByte(ByteBuffer byteBuffer)
Get the compression byte.- Parameters:
byteBuffer- byte buffer- Returns:
- compression byte
-
getHeaderVersionByte
public Byte getHeaderVersionByte(ByteBuffer byteBuffer)
Get the header version byte.- Parameters:
byteBuffer- byte buffer- Returns:
- header byte
-
-