Constructor and Description |
---|
ByteBufJsonHelper() |
Modifier and Type | Method and Description |
---|---|
static int |
findNextChar(ByteBuf buf,
char c)
Shorthand for
ByteBuf.bytesBefore(byte) with a simple char c, finds the number of bytes until next occurrence of the character c from the current readerIndex() in buf. |
static int |
findNextCharNotPrefixedBy(ByteBuf buf,
char c,
char prefix)
Find the number of bytes until next occurrence of the character c from the current
readerIndex in buf, with the twist that if this occurrence is prefixed by the prefix character, we try to find another occurrence. |
static int |
findSectionClosingPosition(ByteBuf buf,
char openingChar,
char closingChar)
Finds the position of the correct closing character, taking into account the fact that before the correct one, other sub section with same opening and closing characters can be encountered.
|
static int |
findSectionClosingPosition(ByteBuf buf,
int startOffset,
char openingChar,
char closingChar)
Finds the position of the correct closing character, taking into account the fact that before the correct one, other sub section with same opening and closing characters can be encountered.
|
static int |
findSplitPosition(ByteBuf buf,
char splitChar)
Finds the position of the split character, taking into account the fact that the character could be found escaped in strings (such occurrences are ignored).
|
public static final int findNextChar(ByteBuf buf, char c)
Shorthand for ByteBuf.bytesBefore(byte)
with a simple char c, finds the number of bytes until next occurrence of the character c from the current readerIndex() in buf.
buf
- the buffer
to look into.c
- the character to search for.ByteBuf.bytesBefore(byte)
public static final int findNextCharNotPrefixedBy(ByteBuf buf, char c, char prefix)
Find the number of bytes until next occurrence of the character c from the current readerIndex
in buf, with the twist that if this occurrence is prefixed by the prefix character, we try to find another occurrence.
buf
- the buffer
to look into.c
- the character to search for.prefix
- the character to trigger a retry.public static int findSectionClosingPosition(ByteBuf buf, char openingChar, char closingChar)
Finds the position of the correct closing character, taking into account the fact that before the correct one, other sub section with same opening and closing characters can be encountered.
This implementation starts for the current readerIndex
.
buf
- the ByteBuf
where to search for the end of a section enclosed in openingChar and closingChar.openingChar
- the section opening char, used to detect a sub-section.closingChar
- the section closing char, used to detect the end of a sub-section / this section.public static final int findSplitPosition(ByteBuf buf, char splitChar)
Finds the position of the split character, taking into account the fact that the character could be found escaped in strings (such occurrences are ignored).
This implementation starts for the current readerIndex
.
buf
- the ByteBuf
where to search for the split character.splitChar
- the split character to detect.public static int findSectionClosingPosition(ByteBuf buf, int startOffset, char openingChar, char closingChar)
Finds the position of the correct closing character, taking into account the fact that before the correct one, other sub section with same opening and closing characters can be encountered.
This implementation starts for the current readerIndex
+ startOffset.
buf
- the ByteBuf
where to search for the end of a section enclosed in openingChar and closingChar.startOffset
- the offset at which to start reading (from buffer’s readerIndex).openingChar
- the section opening char, used to detect a sub-section.closingChar
- the section closing char, used to detect the end of a sub-section / this section.Copyright © 2018 Couchbase, Inc.. All rights reserved.