Class ClosingPositionBufProcessor
java.lang.Object
com.couchbase.client.core.endpoint.util.AbstractStringAwareBufProcessor
com.couchbase.client.core.endpoint.util.ClosingPositionBufProcessor
- All Implemented Interfaces:
ByteBufProcessor
,ByteProcessor
public class ClosingPositionBufProcessor extends AbstractStringAwareBufProcessor implements ByteBufProcessor
A
ByteBufProcessor
to find a closing character position. Applying this to a
buffer will output the position of the closing of the section, relative to that buffer's
readerIndex, or -1 if the end of the section couldn't be found.
Note that this processor will only work correctly if the number of opening and closing
characters match up. This is typically the case when searching for open and closing {}
in a streaming JSON response (in which case the constructor variant that detects JSON
strings should be used).
It is invoked on a ByteBuf
by calling ByteBuf.forEachByte(ByteBufProcessor)
methods.- Since:
- 1.1.0
- Author:
- Simon Baslé
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.netty.util.ByteProcessor
ByteProcessor.IndexNotOfProcessor, ByteProcessor.IndexOfProcessor
-
Field Summary
Fields inherited from interface io.netty.buffer.ByteBufProcessor
FIND_CR, FIND_CRLF, FIND_LF, FIND_LINEAR_WHITESPACE, FIND_NON_CR, FIND_NON_CRLF, FIND_NON_LF, FIND_NON_LINEAR_WHITESPACE, FIND_NON_NUL, FIND_NUL
Fields inherited from interface io.netty.util.ByteProcessor
FIND_ASCII_SPACE, FIND_COMMA, FIND_SEMI_COLON
-
Constructor Summary
Constructors Constructor Description ClosingPositionBufProcessor(char openingChar, char closingChar)
ClosingPositionBufProcessor(char openingChar, char closingChar, boolean detectJsonString)
-
Method Summary
Modifier and Type Method Description boolean
process(byte current)
Methods inherited from class com.couchbase.client.core.endpoint.util.AbstractStringAwareBufProcessor
isEscaped
-
Constructor Details
-
ClosingPositionBufProcessor
public ClosingPositionBufProcessor(char openingChar, char closingChar)- Parameters:
openingChar
- the opening section character (used to detect a sub-section).closingChar
- the closing section character to search for.
-
ClosingPositionBufProcessor
public ClosingPositionBufProcessor(char openingChar, char closingChar, boolean detectJsonString)- Parameters:
openingChar
- the opening section character (used to detect a sub-section)closingChar
- the closing section character to search for.detectJsonString
- set to true to not inspect bytes detected as being part of a String.
-
-
Method Details
-
process
- Specified by:
process
in interfaceByteProcessor
- Throws:
Exception
-