on 2002/10/10 6:14 AM, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> > + } > + > + > + /** > + * Specialized utility method: find a sequence of lower case bytes inside > + * a ByteChunk. > + */ > + protected int findBytes(ByteChunk bc, byte[] b) { > + > + byte first = b[0]; > + byte[] buff = bc.getBuffer(); > + int start = bc.getStart(); > + int end = bc.getEnd(); > + > + // Look for first char > + int srcEnd = b.length; > + > + for (int i = start; i <= (end - srcEnd); i++) { > + if (buff[i] != first) continue; > + // found first char, now look for a match > + int myPos = i+1; > + for (int srcPos = 1; srcPos < srcEnd; ) { > + if (buff[myPos++] != Ascii.toLower(b[srcPos++])) > + break; > + if (srcPos == srcEnd) return i - start; // found it > + } > + } > + return -1; > + Tabs. -jon -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>