From 0fee01aa2d4ad8347641698fb178c77b6fc95517 Mon Sep 17 00:00:00 2001 From: Sebastian Bazley Date: Wed, 28 Mar 2012 13:41:42 +0000 Subject: [PATCH] Add method for detecting start of line git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1306322 13f79535-47bb-0310-9956-ffa450edef68 --- src/main/java/org/apache/commons/csv/Lexer.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main/java/org/apache/commons/csv/Lexer.java b/src/main/java/org/apache/commons/csv/Lexer.java index 49e946f8..ca49346b 100644 --- a/src/main/java/org/apache/commons/csv/Lexer.java +++ b/src/main/java/org/apache/commons/csv/Lexer.java @@ -111,6 +111,16 @@ abstract class Lexer { return (c == '\n' || c == '\r'); } + /** + * Checks if the current character represents the start of a line: + * a CR, LF or is at the start of the file. + * + * @param c + * @return true if the character is at the start of a line. + */ + boolean isStartOfLine(int c) { + return c == '\n' || c == '\r' || c == ExtendedBufferedReader.UNDEFINED; + } /** * @return true if the given character indicates end of file */