From 6f6cc60b5161476fd5635aaaa6f32421cb90a496 Mon Sep 17 00:00:00 2001 From: Ash Date: Tue, 24 Oct 2023 01:06:43 -0700 Subject: [PATCH] Removed redundant casts from DirectBinaryDecoder (#2563) thanks to @mystic-lama for this improvement --- .../main/java/org/apache/avro/io/DirectBinaryDecoder.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lang/java/avro/src/main/java/org/apache/avro/io/DirectBinaryDecoder.java b/lang/java/avro/src/main/java/org/apache/avro/io/DirectBinaryDecoder.java index 6f07b13eee2..71f3ed593af 100644 --- a/lang/java/avro/src/main/java/org/apache/avro/io/DirectBinaryDecoder.java +++ b/lang/java/avro/src/main/java/org/apache/avro/io/DirectBinaryDecoder.java @@ -45,10 +45,10 @@ public ByteBuffer read(ByteBuffer old, int length) throws IOException { result = old; result.clear(); } else { - result = ByteBuffer.allocate((int) length); + result = ByteBuffer.allocate(length); } - doReadBytes(result.array(), result.position(), (int) length); - result.limit((int) length); + doReadBytes(result.array(), result.position(), length); + result.limit(length); return result; } } @@ -65,7 +65,7 @@ public ByteBuffer read(ByteBuffer old, int length) throws IOException { if (old != null) { return super.read(old, length); } else { - return bbi.readBuffer((int) length); + return bbi.readBuffer(length); } } }