for (int i = MAX (nl-hl, 0); i < nl; i++) {
//if (haystack.compare (needle, hl-(nl-i), nl-i) == 0) {
for (int i = MAX (nl-hl, 0); i < nl; i++) {
//if (haystack.compare (needle, hl-(nl-i), nl-i) == 0) {
if ( bytesToCollect > 0) {
const int toRead = std::min(in_buffer.getLength(), bytesToCollect);
collectIncomingData(in_buffer.getData(), toRead);
if ( bytesToCollect > 0) {
const int toRead = std::min(in_buffer.getLength(), bytesToCollect);
collectIncomingData(in_buffer.getData(), toRead);
if (index != -1) {
// we found the terminator
collectIncomingData ( in_buffer.getData(), index ) ;
if (index != -1) {
// we found the terminator
collectIncomingData ( in_buffer.getData(), index ) ;