1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.jboss.netty.buffer;
17
18
19
20
21
22
23
24
25
26
27
28
29
30 public interface ChannelBufferIndexFinder {
31
32
33
34
35
36
37
38
39
40 boolean find(ChannelBuffer buffer, int guessedIndex);
41
42
43
44
45 ChannelBufferIndexFinder NUL = new ChannelBufferIndexFinder() {
46 public boolean find(ChannelBuffer buffer, int guessedIndex) {
47 return buffer.getByte(guessedIndex) == 0;
48 }
49 };
50
51
52
53
54 ChannelBufferIndexFinder NOT_NUL = new ChannelBufferIndexFinder() {
55 public boolean find(ChannelBuffer buffer, int guessedIndex) {
56 return buffer.getByte(guessedIndex) != 0;
57 }
58 };
59
60
61
62
63 ChannelBufferIndexFinder CR = new ChannelBufferIndexFinder() {
64 public boolean find(ChannelBuffer buffer, int guessedIndex) {
65 return buffer.getByte(guessedIndex) == '\r';
66 }
67 };
68
69
70
71
72 ChannelBufferIndexFinder NOT_CR = new ChannelBufferIndexFinder() {
73 public boolean find(ChannelBuffer buffer, int guessedIndex) {
74 return buffer.getByte(guessedIndex) != '\r';
75 }
76 };
77
78
79
80
81 ChannelBufferIndexFinder LF = new ChannelBufferIndexFinder() {
82 public boolean find(ChannelBuffer buffer, int guessedIndex) {
83 return buffer.getByte(guessedIndex) == '\n';
84 }
85 };
86
87
88
89
90 ChannelBufferIndexFinder NOT_LF = new ChannelBufferIndexFinder() {
91 public boolean find(ChannelBuffer buffer, int guessedIndex) {
92 return buffer.getByte(guessedIndex) != '\n';
93 }
94 };
95
96
97
98
99 ChannelBufferIndexFinder CRLF = new ChannelBufferIndexFinder() {
100 public boolean find(ChannelBuffer buffer, int guessedIndex) {
101 byte b = buffer.getByte(guessedIndex);
102 return b == '\r' || b == '\n';
103 }
104 };
105
106
107
108
109
110 ChannelBufferIndexFinder NOT_CRLF = new ChannelBufferIndexFinder() {
111 public boolean find(ChannelBuffer buffer, int guessedIndex) {
112 byte b = buffer.getByte(guessedIndex);
113 return b != '\r' && b != '\n';
114 }
115 };
116
117
118
119
120
121 ChannelBufferIndexFinder LINEAR_WHITESPACE = new ChannelBufferIndexFinder() {
122 public boolean find(ChannelBuffer buffer, int guessedIndex) {
123 byte b = buffer.getByte(guessedIndex);
124 return b == ' ' || b == '\t';
125 }
126 };
127
128
129
130
131
132 ChannelBufferIndexFinder NOT_LINEAR_WHITESPACE = new ChannelBufferIndexFinder() {
133 public boolean find(ChannelBuffer buffer, int guessedIndex) {
134 byte b = buffer.getByte(guessedIndex);
135 return b != ' ' && b != '\t';
136 }
137 };
138 }