Added support for non POSIX line endings. Will now accept: \r and \r\n as line endings (per Sun's JavaDoc)

This commit is contained in:
Seth Goings 2011-08-31 20:46:15 -06:00
parent 5542ad4ed4
commit c75b06ddc1

View File

@ -42,9 +42,12 @@ public class BufferedReader extends Reader {
}
for (int i = position; i < limit; ++i) {
if (buffer[i] == '\n') {
if (buffer[i] == '\n' || buffer[i] == '\r') {
sb.append(buffer, position, i - position);
position = i + 1;
if(buffer[i+1] != null && buffer[i+1] == '\n') {
position = i + 1;
}
return sb.toString();
}
}