Mercurial Hosting > luan
comparison src/org/eclipse/jetty/io/AbstractBuffer.java @ 1029:4e5e9e3c25b3
remove Buffer.equalsIgnoreCase()
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Thu, 03 Nov 2016 00:55:20 -0600 |
parents | 6d17a257b03f |
children | 80cad9086593 |
comparison
equal
deleted
inserted
replaced
1028:2ea54e6117c3 | 1029:4e5e9e3c25b3 |
---|---|
156 for (int i = putIndex(); i-->get;) | 156 for (int i = putIndex(); i-->get;) |
157 { | 157 { |
158 byte b1 = peek(i); | 158 byte b1 = peek(i); |
159 byte b2 = b.peek(--bi); | 159 byte b2 = b.peek(--bi); |
160 if (b1 != b2) return false; | 160 if (b1 != b2) return false; |
161 } | |
162 return true; | |
163 } | |
164 | |
165 public boolean equalsIgnoreCase(Buffer b) | |
166 { | |
167 if (b==this) | |
168 return true; | |
169 | |
170 // reject different lengths | |
171 if (b.length() != length()) return false; | |
172 | |
173 // reject AbstractBuffer with different hash value | |
174 if (_hash != 0 && b instanceof AbstractBuffer) | |
175 { | |
176 AbstractBuffer ab = (AbstractBuffer) b; | |
177 if (ab._hash != 0 && _hash != ab._hash) return false; | |
178 } | |
179 | |
180 // Nothing for it but to do the hard grind. | |
181 int get=getIndex(); | |
182 int bi=b.putIndex(); | |
183 | |
184 byte[] array = array(); | |
185 byte[] barray= b.array(); | |
186 if (array!=null && barray!=null) | |
187 { | |
188 for (int i = putIndex(); i-->get;) | |
189 { | |
190 byte b1 = array[i]; | |
191 byte b2 = barray[--bi]; | |
192 if (b1 != b2) | |
193 { | |
194 if ('a' <= b1 && b1 <= 'z') b1 = (byte) (b1 - 'a' + 'A'); | |
195 if ('a' <= b2 && b2 <= 'z') b2 = (byte) (b2 - 'a' + 'A'); | |
196 if (b1 != b2) return false; | |
197 } | |
198 } | |
199 } | |
200 else | |
201 { | |
202 for (int i = putIndex(); i-->get;) | |
203 { | |
204 byte b1 = peek(i); | |
205 byte b2 = b.peek(--bi); | |
206 if (b1 != b2) | |
207 { | |
208 if ('a' <= b1 && b1 <= 'z') b1 = (byte) (b1 - 'a' + 'A'); | |
209 if ('a' <= b2 && b2 <= 'z') b2 = (byte) (b2 - 'a' + 'A'); | |
210 if (b1 != b2) return false; | |
211 } | |
212 } | |
213 } | 161 } |
214 return true; | 162 return true; |
215 } | 163 } |
216 | 164 |
217 public byte get() | 165 public byte get() |