public class SchemaNormalization extends Object
toParsingForm(org.apache.avro.Schema)
) -- and fingerprints of cannonical
forms (fingerprint(java.lang.String, byte[])
).Modifier and Type | Method and Description |
---|---|
static byte[] |
fingerprint(String fpName,
byte[] data)
Returns a fingerprint of a string of bytes.
|
static long |
fingerprint64(byte[] data)
Returns the 64-bit Rabin Fingerprint (as recommended in the Avro
spec) of a byte string.
|
static byte[] |
parsingFingerprint(String fpName,
Schema s)
Returns
fingerprint(java.lang.String, byte[]) applied to the parsing canonical form
of the supplied schema. |
static long |
parsingFingerprint64(Schema s)
Returns
fingerprint64(byte[]) applied to the parsing canonical form
of the supplied schema. |
static String |
toParsingForm(Schema s)
Returns "Parsing Canonical Form" of a schema as defined by Avro
spec.
|
public static String toParsingForm(Schema s)
public static byte[] fingerprint(String fpName, byte[] data) throws NoSuchAlgorithmException
"CRC-64-AVRO"
, then the result of fingerprint64(byte[])
is
returned in little-endian format. Otherwise, fpName is
used as an algorithm name for MessageDigest.getInstance(String)
, which will throw
NoSuchAlgorithmException
if it doesn't recognize
the name.
Recommended Avro practice dictiates that
"CRC-64-AVRO"
is used for 64-bit fingerprints,
"MD5"
is used for 128-bit fingerprints, and
"SHA-256"
is used for 256-bit fingerprints.
NoSuchAlgorithmException
public static long fingerprint64(byte[] data)
public static byte[] parsingFingerprint(String fpName, Schema s) throws NoSuchAlgorithmException
fingerprint(java.lang.String, byte[])
applied to the parsing canonical form
of the supplied schema.NoSuchAlgorithmException
public static long parsingFingerprint64(Schema s)
fingerprint64(byte[])
applied to the parsing canonical form
of the supplied schema.Copyright © 2009-2012 The Apache Software Foundation. All Rights Reserved.