mkeskells commented on code in PR #3776:
URL: https://github.com/apache/avro/pull/3776#discussion_r3448297263


##########
lang/java/avro/src/main/java/org/apache/avro/io/Decoder.java:
##########
@@ -126,6 +129,22 @@ public abstract class Decoder {
    */
   public abstract ByteBuffer readBytes(ByteBuffer old) throws IOException;
 
+  /**
+   * Reads a byte-string written by {@link Encoder#writeBytes}.
+   * <p>
+   * This is useful when you want to avoid the creation of a ByteBuffer, and 
only
+   * want the byte[], e.g.:
+   *
+   * <pre>
+   * ByteBuffer buffer = decoder.readBytes(null);
+   * byte[] array = buffer.array();
+   * </pre>
+   *
+   * @throws AvroTypeException If this is a stateful reader and byte-string is 
not
+   *                           the type of the next value to be read
+   */
+  public abstract byte[] readBytes() throws IOException;

Review Comment:
   I am not aware of the expectations on up/downgrade, and if this is 
appropriate. Happy to make a change if i is the right thing to do, but it looks 
to me as if if that is the case the default implementation should be removed on 
the next opportunity for a braking change, be that major or minor version, 
based on the policy of the avro project



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to