boolean (CharIterator it) { while (it.hasData()) { final char ch = it.nextChar(); if (ch == '\r') { myFoundCR = true; } else if (ch == '\n') { myFoundCR = false; return true; } else { if (myFoundCR) { myData.append('\r'); myFoundCR = false; } myData.append(ch); } } return false; }