/** * Finds the line separator used in the given character sequence portion, or returns * {@code null} if unknown. This method is designed for invocation at the beginning * of {@code append(CharSequence, ...)}, before the characters are effectively read. */ final String lineSeparator(final CharSequence sequence, int start, final int end) { if (isHighSurrogate()) { start++; // Skip invalid character. } while (start < end) { final int c = Character.codePointAt(sequence, start); final int b = start; start += Character.charCount(c); if (isLineOrParagraphSeparator(c)) { if (c == '\r' && (start < end) && sequence.charAt(start) == '\n') { start++; } return sequence.subSequence(b, start).toString(); } } return null; }
/** * Finds the line separator used in the given character sequence portion, or returns * {@code null} if unknown. This method is designed for invocation at the beginning * of {@code append(CharSequence, ...)}, before the characters are effectively read. */ final String lineSeparator(final CharSequence sequence, int start, final int end) { if (isHighSurrogate()) { start++; // Skip invalid character. } while (start < end) { final int c = Character.codePointAt(sequence, start); final int b = start; start += Character.charCount(c); if (isLineOrParagraphSeparator(c)) { if (c == '\r' && (start < end) && sequence.charAt(start) == '\n') { start++; } return sequence.subSequence(b, start).toString(); } } return null; }