16
16
package io .reactivex .netty .protocol .http .sse ;
17
17
18
18
import io .netty .buffer .ByteBuf ;
19
- import io .netty .buffer .ByteBufProcessor ;
20
19
import io .netty .channel .ChannelHandlerContext ;
21
20
import io .netty .handler .codec .ByteToMessageDecoder ;
21
+ import io .netty .util .ByteProcessor ;
22
22
import org .slf4j .Logger ;
23
23
import org .slf4j .LoggerFactory ;
24
24
@@ -38,36 +38,36 @@ public class ServerSentEventDecoder extends ByteToMessageDecoder {
38
38
private static final char [] DATA_FIELD_NAME = "data" .toCharArray ();
39
39
private static final char [] ID_FIELD_NAME = "id" .toCharArray ();
40
40
41
- protected static final ByteBufProcessor SKIP_TILL_LINE_DELIMITER_PROCESSOR = new ByteBufProcessor () {
41
+ protected static final ByteProcessor SKIP_TILL_LINE_DELIMITER_PROCESSOR = new ByteProcessor () {
42
42
@ Override
43
43
public boolean process (byte value ) throws Exception {
44
44
return !isLineDelimiter ((char ) value );
45
45
}
46
46
};
47
47
48
- protected static final ByteBufProcessor SKIP_LINE_DELIMITERS_AND_SPACES_PROCESSOR = new ByteBufProcessor () {
48
+ protected static final ByteProcessor SKIP_LINE_DELIMITERS_AND_SPACES_PROCESSOR = new ByteProcessor () {
49
49
@ Override
50
50
public boolean process (byte value ) throws Exception {
51
51
return isLineDelimiter ((char ) value ) || (char ) value == ' ' ;
52
52
}
53
53
};
54
54
55
- protected static final ByteBufProcessor SKIP_COLON_AND_WHITE_SPACE_PROCESSOR = new ByteBufProcessor () {
55
+ protected static final ByteProcessor SKIP_COLON_AND_WHITE_SPACE_PROCESSOR = new ByteProcessor () {
56
56
@ Override
57
57
public boolean process (byte value ) throws Exception {
58
58
char valueChar = (char ) value ;
59
59
return valueChar == ':' || valueChar == ' ' ;
60
60
}
61
61
};
62
62
63
- protected static final ByteBufProcessor SCAN_COLON_PROCESSOR = new ByteBufProcessor () {
63
+ protected static final ByteProcessor SCAN_COLON_PROCESSOR = new ByteProcessor () {
64
64
@ Override
65
65
public boolean process (byte value ) throws Exception {
66
66
return (char ) value != ':' ;
67
67
}
68
68
};
69
69
70
- protected static final ByteBufProcessor SCAN_EOL_PROCESSOR = new ByteBufProcessor () {
70
+ protected static final ByteProcessor SCAN_EOL_PROCESSOR = new ByteProcessor () {
71
71
@ Override
72
72
public boolean process (byte value ) throws Exception {
73
73
return !isLineDelimiter ((char ) value );
@@ -340,7 +340,7 @@ private static boolean skipTillEOL(ByteBuf in) {
340
340
return skipTillMatching (in , SKIP_TILL_LINE_DELIMITER_PROCESSOR );
341
341
}
342
342
343
- protected static boolean skipTillMatching (ByteBuf byteBuf , ByteBufProcessor processor ) {
343
+ protected static boolean skipTillMatching (ByteBuf byteBuf , ByteProcessor processor ) {
344
344
final int lastIndexProcessed = byteBuf .forEachByte (processor );
345
345
if (-1 == lastIndexProcessed ) {
346
346
byteBuf .readerIndex (byteBuf .readerIndex () + byteBuf .readableBytes ()); // If all the remaining bytes are to be ignored, discard the buffer.
0 commit comments