lkuchars commented on code in PR #10105:
URL: https://github.com/apache/nifi/pull/10105#discussion_r2254106420


##########
nifi-extension-bundles/nifi-confluent-platform-bundle/nifi-confluent-protobuf-message-name-resolver/src/main/java/org/apache/nifi/confluent/schemaregistry/VarintUtils.java:
##########
@@ -0,0 +1,151 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.nifi.confluent.schemaregistry;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+/**
+ * Utility class for reading, writing and decoding varint values from input 
streams.
+ * This class provides methods for reading variable-length integers (varints),
+ * writing zigzag-encoded varints, and decoding zigzag-encoded integers as per 
the Protocol Buffers specification.
+ */
+public final class VarintUtils {
+
+    private VarintUtils() { }
+
+    /**
+     * Reads a single varint from the input stream.
+     *
+     * <p>Variable-length integers (varints) are a method of serializing 
integers using one or more bytes.
+     * Smaller numbers take fewer bytes. Each byte in a varint, except the 
last byte, has the most
+     * significant bit set – this indicates that there are further bytes to 
come. The lower 7 bits
+     * of each byte are used to store the two's complement representation of 
the number in groups of 7 bits,
+     * least significant group first.</p>
+     *
+     * <p>For more information about varint encoding, see:
+     * <a 
href="https://en.wikipedia.org/wiki/Variable-length_quantity";>Variable-length 
quantity - Wikipedia</a></p>
+     *
+     * <p>This implementation follows the Protocol Buffers varint encoding 
format as described in:
+     * <a 
href="https://developers.google.com/protocol-buffers/docs/encoding#varints";>Protocol
 Buffers Encoding</a></p>

Review Comment:
   Done



-- 
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