From 79c0b925798343f03e475af4189a16bec3edac5d Mon Sep 17 00:00:00 2001 From: Adrian Cole Date: Fri, 1 Mar 2024 15:56:10 +0800 Subject: [PATCH] no FUD Signed-off-by: Adrian Cole --- util/src/main/java/io/kubernetes/client/ProtoClient.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/util/src/main/java/io/kubernetes/client/ProtoClient.java b/util/src/main/java/io/kubernetes/client/ProtoClient.java index 1a8b339e03..dc633449e7 100644 --- a/util/src/main/java/io/kubernetes/client/ProtoClient.java +++ b/util/src/main/java/io/kubernetes/client/ProtoClient.java @@ -313,9 +313,7 @@ private static byte[] encode(Message msg, String apiVersion, String kind) throws .setRaw(msg.toByteString()) .build(); - // Encode directly to an array, to reduce buffering. CodedOutputStream will - // still allocate arrays internally, but this is the best we can do without - // something that quickly looks like square/wire. + // Encode directly to a sized array, to eliminate buffering int serializedSize = u.getSerializedSize(); byte[] result = new byte[MAGIC.length + u.getSerializedSize()]; System.arraycopy(MAGIC, 0, result, 0, MAGIC.length);