Add public Slice.indexOfByte with offset and length and Slice.indexOfAnyByte - #195
Conversation
|
I have use-case for these two methods |
📝 WalkthroughWalkthrough
🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/main/java/io/airlift/slice/Slice.java (1)
1147-1184: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winConsider adding
@throwsjavadoc for the new region-bounded overloads andindexOfAnyByte.Every other indexed accessor in this class (
getByte,getShort,getInt, etc.) documents itsIndexOutOfBoundsExceptioncontract. The newindexOfByte(int, offset, length),indexOfByte(byte, offset, length)(lines 1107-1121), andindexOfAnyByte(lines 1142-1146) only describe the return value, not the bounds-check behavior verified by the new tests.✏️ Example addition
/** * Returns the index of the first occurrence of the byte within the specified * region of this slice. If the byte is not found -1 is returned. + * + * `@throws` IndexOutOfBoundsException if offset or length is negative, or offset + length is greater than this.length() */ public int indexOfByte(byte b, int offset, int length)
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 12508c77-4505-4009-a95f-6daea6136a26
📒 Files selected for processing (2)
src/main/java/io/airlift/slice/Slice.javasrc/test/java/io/airlift/slice/TestSlice.java
No description provided.