From 5ea12f7c73795ab62f043e4f0fd0f3ab5c857212 Mon Sep 17 00:00:00 2001 From: guawang <73365665+guawang@users.noreply.github.com> Date: Thu, 4 Mar 2021 12:05:55 -0800 Subject: [PATCH] add new API for boundedMemoryDecoder (#134) --- .../com/linkedin/avroutil1/compatibility/AvroAdapter.java | 2 ++ .../avroutil1/compatibility/avro110/Avro110Adapter.java | 5 +++++ .../avroutil1/compatibility/avro14/Avro14Adapter.java | 5 +++++ .../avroutil1/compatibility/avro15/Avro15Adapter.java | 5 +++++ .../avroutil1/compatibility/avro16/Avro16Adapter.java | 5 +++++ .../avroutil1/compatibility/avro17/Avro17Adapter.java | 5 +++++ .../avroutil1/compatibility/avro18/Avro18Adapter.java | 5 +++++ .../avroutil1/compatibility/avro19/Avro19Adapter.java | 5 +++++ 8 files changed, 37 insertions(+) diff --git a/helper/helper-common/src/main/java/com/linkedin/avroutil1/compatibility/AvroAdapter.java b/helper/helper-common/src/main/java/com/linkedin/avroutil1/compatibility/AvroAdapter.java index f6c1462c8..37c798593 100644 --- a/helper/helper-common/src/main/java/com/linkedin/avroutil1/compatibility/AvroAdapter.java +++ b/helper/helper-common/src/main/java/com/linkedin/avroutil1/compatibility/AvroAdapter.java @@ -62,6 +62,8 @@ BinaryDecoder newBinaryDecoder(byte[] bytes, int offset, Decoder newBoundedMemoryDecoder(InputStream in) throws IOException; + Decoder newBoundedMemoryDecoder(byte[] data) throws IOException; + //parsing and Schema-related SchemaParseResult parse(String schemaJson, SchemaParseConfiguration desiredConf, Collection known); diff --git a/helper/impls/helper-impl-110/src/main/java/com/linkedin/avroutil1/compatibility/avro110/Avro110Adapter.java b/helper/impls/helper-impl-110/src/main/java/com/linkedin/avroutil1/compatibility/avro110/Avro110Adapter.java index a66a6a3b3..3284752b4 100644 --- a/helper/impls/helper-impl-110/src/main/java/com/linkedin/avroutil1/compatibility/avro110/Avro110Adapter.java +++ b/helper/impls/helper-impl-110/src/main/java/com/linkedin/avroutil1/compatibility/avro110/Avro110Adapter.java @@ -173,6 +173,11 @@ public Decoder newBoundedMemoryDecoder(InputStream in) throws IOException { return new BoundedMemoryDecoder(in); } + @Override + public Decoder newBoundedMemoryDecoder(byte[] data) throws IOException { + return new BoundedMemoryDecoder(data); + } + @Override public SchemaParseResult parse(String schemaJson, SchemaParseConfiguration desiredConf, Collection known) { Schema.Parser parser = new Schema.Parser(); diff --git a/helper/impls/helper-impl-14/src/main/java/com/linkedin/avroutil1/compatibility/avro14/Avro14Adapter.java b/helper/impls/helper-impl-14/src/main/java/com/linkedin/avroutil1/compatibility/avro14/Avro14Adapter.java index 07eef5766..cfb99bed3 100644 --- a/helper/impls/helper-impl-14/src/main/java/com/linkedin/avroutil1/compatibility/avro14/Avro14Adapter.java +++ b/helper/impls/helper-impl-14/src/main/java/com/linkedin/avroutil1/compatibility/avro14/Avro14Adapter.java @@ -165,6 +165,11 @@ public Decoder newBoundedMemoryDecoder(InputStream in) throws IOException { return new BoundedMemoryDecoder(in); } + @Override + public Decoder newBoundedMemoryDecoder(byte[] data) throws IOException { + return new BoundedMemoryDecoder(data); + } + @Override public SchemaParseResult parse(String schemaJson, SchemaParseConfiguration desiredConf, Collection known) { SchemaParseResult result = Avro14SchemaAccessUtil.parse(schemaJson, known); diff --git a/helper/impls/helper-impl-15/src/main/java/com/linkedin/avroutil1/compatibility/avro15/Avro15Adapter.java b/helper/impls/helper-impl-15/src/main/java/com/linkedin/avroutil1/compatibility/avro15/Avro15Adapter.java index 2325805c5..fdc45ae2d 100644 --- a/helper/impls/helper-impl-15/src/main/java/com/linkedin/avroutil1/compatibility/avro15/Avro15Adapter.java +++ b/helper/impls/helper-impl-15/src/main/java/com/linkedin/avroutil1/compatibility/avro15/Avro15Adapter.java @@ -168,6 +168,11 @@ public Decoder newBoundedMemoryDecoder(InputStream in) throws IOException { return new BoundedMemoryDecoder(in); } + @Override + public Decoder newBoundedMemoryDecoder(byte[] data) throws IOException { + return new BoundedMemoryDecoder(data); + } + @Override public SchemaParseResult parse(String schemaJson, SchemaParseConfiguration desiredConf, Collection known) { Schema.Parser parser = new Schema.Parser(); diff --git a/helper/impls/helper-impl-16/src/main/java/com/linkedin/avroutil1/compatibility/avro16/Avro16Adapter.java b/helper/impls/helper-impl-16/src/main/java/com/linkedin/avroutil1/compatibility/avro16/Avro16Adapter.java index 762fc9f3f..c9ddddb26 100644 --- a/helper/impls/helper-impl-16/src/main/java/com/linkedin/avroutil1/compatibility/avro16/Avro16Adapter.java +++ b/helper/impls/helper-impl-16/src/main/java/com/linkedin/avroutil1/compatibility/avro16/Avro16Adapter.java @@ -174,6 +174,11 @@ public Decoder newBoundedMemoryDecoder(InputStream in) throws IOException { return new BoundedMemoryDecoder(in); } + @Override + public Decoder newBoundedMemoryDecoder(byte[] data) throws IOException { + return new BoundedMemoryDecoder(data); + } + @Override public SchemaParseResult parse(String schemaJson, SchemaParseConfiguration desiredConf, Collection known) { Schema.Parser parser = new Schema.Parser(); diff --git a/helper/impls/helper-impl-17/src/main/java/com/linkedin/avroutil1/compatibility/avro17/Avro17Adapter.java b/helper/impls/helper-impl-17/src/main/java/com/linkedin/avroutil1/compatibility/avro17/Avro17Adapter.java index 8fe805644..a6796a335 100644 --- a/helper/impls/helper-impl-17/src/main/java/com/linkedin/avroutil1/compatibility/avro17/Avro17Adapter.java +++ b/helper/impls/helper-impl-17/src/main/java/com/linkedin/avroutil1/compatibility/avro17/Avro17Adapter.java @@ -217,6 +217,11 @@ public Decoder newBoundedMemoryDecoder(InputStream in) throws IOException { return new BoundedMemoryDecoder(in); } + @Override + public Decoder newBoundedMemoryDecoder(byte[] data) throws IOException { + return new BoundedMemoryDecoder(data); + } + @Override public SchemaParseResult parse(String schemaJson, SchemaParseConfiguration desiredConf, Collection known) { Schema.Parser parser = new Schema.Parser(); diff --git a/helper/impls/helper-impl-18/src/main/java/com/linkedin/avroutil1/compatibility/avro18/Avro18Adapter.java b/helper/impls/helper-impl-18/src/main/java/com/linkedin/avroutil1/compatibility/avro18/Avro18Adapter.java index 7f707349e..3f7a42a86 100644 --- a/helper/impls/helper-impl-18/src/main/java/com/linkedin/avroutil1/compatibility/avro18/Avro18Adapter.java +++ b/helper/impls/helper-impl-18/src/main/java/com/linkedin/avroutil1/compatibility/avro18/Avro18Adapter.java @@ -176,6 +176,11 @@ public Decoder newBoundedMemoryDecoder(InputStream in) throws IOException { return new BoundedMemoryDecoder(in); } + @Override + public Decoder newBoundedMemoryDecoder(byte[] data) throws IOException { + return new BoundedMemoryDecoder(data); + } + @Override public SchemaParseResult parse(String schemaJson, SchemaParseConfiguration desiredConf, Collection known) { Schema.Parser parser = new Schema.Parser(); diff --git a/helper/impls/helper-impl-19/src/main/java/com/linkedin/avroutil1/compatibility/avro19/Avro19Adapter.java b/helper/impls/helper-impl-19/src/main/java/com/linkedin/avroutil1/compatibility/avro19/Avro19Adapter.java index 9ce1da37e..9758beaac 100644 --- a/helper/impls/helper-impl-19/src/main/java/com/linkedin/avroutil1/compatibility/avro19/Avro19Adapter.java +++ b/helper/impls/helper-impl-19/src/main/java/com/linkedin/avroutil1/compatibility/avro19/Avro19Adapter.java @@ -176,6 +176,11 @@ public Decoder newBoundedMemoryDecoder(InputStream in) throws IOException { return new BoundedMemoryDecoder(in); } + @Override + public Decoder newBoundedMemoryDecoder(byte[] data) throws IOException { + return new BoundedMemoryDecoder(data); + } + @Override public SchemaParseResult parse(String schemaJson, SchemaParseConfiguration desiredConf, Collection known) { Schema.Parser parser = new Schema.Parser();