This is an automated email from the ASF dual-hosted git repository.

pvillard pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi.git


The following commit(s) were added to refs/heads/main by this push:
     new 99436b99875 NIFI-15666: Complete NaiveSearchRingBuffer usage example 
in Javadoc
99436b99875 is described below

commit 99436b998754c3ec30c24f2181443ae6f214677a
Author: machov <[email protected]>
AuthorDate: Wed Mar 4 03:51:51 2026 -0500

    NIFI-15666: Complete NaiveSearchRingBuffer usage example in Javadoc
    
    Improves the Javadoc example for NaiveSearchRingBuffer by replacing
    incomplete TODO placeholder with a complete, working code example.
    
    Changes Made:
    - Removed TODO comment and provided concrete byte sequence assignment
    - Fixed incorrect class name in example (CircularBuffer -> 
NaiveSearchRingBuffer)
    - Added proper type casting for addAndCompare() method call
    - Provided realistic example using newline delimiter search pattern
    - Added explanatory comment to clarify the search purpose
    
    This change improves developer experience by providing a complete,
    copy-paste ready example instead of leaving developers to figure out
    the missing implementation details.
    
    Fixes NIFI-15666
    
    This closes #10961.
    
    Signed-off-by: Pierre Villard <[email protected]>
---
 .../src/main/java/org/apache/nifi/util/NaiveSearchRingBuffer.java  | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git 
a/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/util/NaiveSearchRingBuffer.java
 
b/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/util/NaiveSearchRingBuffer.java
index f1d82e1a920..d87d316e1c7 100644
--- 
a/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/util/NaiveSearchRingBuffer.java
+++ 
b/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/util/NaiveSearchRingBuffer.java
@@ -31,11 +31,12 @@ import java.util.Arrays;
  * <p>
  * The intended usage paradigm is:
  * {@snippet :
- *     final byte[] searchSequence; //TODO assignment
- *     final CircularBuffer buffer = new CircularBuffer(searchSequence);
+ *     // Search for newline delimiter in a stream
+ *     final byte[] searchSequence = "\n".getBytes();
+ *     final NaiveSearchRingBuffer buffer = new 
NaiveSearchRingBuffer(searchSequence);
  *     int nextByte;
  *     while ((nextByte = in.read()) > 0) {
- *         if ( buffer.addAndCompare(nextByte) ) {
+ *         if ( buffer.addAndCompare((byte) nextByte) ) {
  *             // This byte is the last byte in the given sequence
  *         } else {
  *             // This byte does not complete the given sequence

Reply via email to