Author: ggregory Date: Sat Oct 13 17:40:05 2012 New Revision: 1397911 URL: http://svn.apache.org/viewvc?rev=1397911&view=rev Log: Rename readAgain() to getLastChar()
Modified: commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVLexer.java commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/ExtendedBufferedReader.java commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexer1.java commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexer1306663.java commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexer1306667.java commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/ExtendedBufferedReaderTest.java Modified: commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVLexer.java URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVLexer.java?rev=1397911&r1=1397910&r2=1397911&view=diff ============================================================================== --- commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVLexer.java (original) +++ commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVLexer.java Sat Oct 13 17:40:05 2012 @@ -47,7 +47,7 @@ final class CSVLexer extends Lexer { Token nextToken(final Token token) throws IOException { // get the last read char (required for empty line detection) - int lastChar = in.readAgain(); + int lastChar = in.getLastChar(); // read the next char and set eol int c = in.read(); Modified: commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/ExtendedBufferedReader.java URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/ExtendedBufferedReader.java?rev=1397911&r1=1397910&r2=1397911&view=diff ============================================================================== --- commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/ExtendedBufferedReader.java (original) +++ commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/ExtendedBufferedReader.java Sat Oct 13 17:40:05 2012 @@ -65,7 +65,7 @@ final class ExtendedBufferedReader exten * * @return the last character that was read */ - int readAgain() { + int getLastChar() { return lastChar; } Modified: commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexer1.java URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexer1.java?rev=1397911&r1=1397910&r2=1397911&view=diff ============================================================================== --- commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexer1.java (original) +++ commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexer1.java Sat Oct 13 17:40:05 2012 @@ -47,7 +47,7 @@ class CSVLexer1 extends Lexer { wsBuf.setLength(0); // reuse // get the last read char (required for empty line detection) - int lastChar = in.readAgain(); + int lastChar = in.getLastChar(); // read the next char and set eol /* note: unfortunately isEndOfLine may consumes a character silently. @@ -56,7 +56,7 @@ class CSVLexer1 extends Lexer { */ int c = in.read(); boolean eol = isEndOfLine(c); - c = in.readAgain(); + c = in.getLastChar(); // empty line detection: eol AND (last char was EOL or beginning) if (format.getIgnoreEmptyLines()) { @@ -67,7 +67,7 @@ class CSVLexer1 extends Lexer { lastChar = c; c = in.read(); eol = isEndOfLine(c); - c = in.readAgain(); + c = in.getLastChar(); // reached end of file without any content (empty line at the end) if (isEndOfFile(c)) { tkn.type = EOF; Modified: commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexer1306663.java URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexer1306663.java?rev=1397911&r1=1397910&r2=1397911&view=diff ============================================================================== --- commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexer1306663.java (original) +++ commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexer1306663.java Sat Oct 13 17:40:05 2012 @@ -45,7 +45,7 @@ class CSVLexer1306663 extends Lexer { Token nextToken(final Token tkn) throws IOException { // get the last read char (required for empty line detection) - int lastChar = in.readAgain(); + int lastChar = in.getLastChar(); // read the next char and set eol int c = in.read(); @@ -61,7 +61,7 @@ class CSVLexer1306663 extends Lexer { * is to call 'readAgain' on the stream... */ boolean eol = isEndOfLine(c); - c = in.readAgain(); + c = in.getLastChar(); // empty line detection: eol AND (last char was EOL or beginning) if (ignoreEmptyLines) { @@ -70,7 +70,7 @@ class CSVLexer1306663 extends Lexer { lastChar = c; c = in.read(); eol = isEndOfLine(c); - c = in.readAgain(); + c = in.getLastChar(); // reached end of file without any content (empty line at the end) if (isEndOfFile(c)) { tkn.type = EOF; Modified: commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexer1306667.java URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexer1306667.java?rev=1397911&r1=1397910&r2=1397911&view=diff ============================================================================== --- commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexer1306667.java (original) +++ commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexer1306667.java Sat Oct 13 17:40:05 2012 @@ -45,7 +45,7 @@ class CSVLexer1306667 extends Lexer { Token nextToken(final Token tkn) throws IOException { // get the last read char (required for empty line detection) - int lastChar = in.readAgain(); + int lastChar = in.getLastChar(); // read the next char and set eol int c = in.read(); @@ -55,7 +55,7 @@ class CSVLexer1306667 extends Lexer { * is to call 'readAgain' on the stream... */ boolean eol = isEndOfLine(c); - c = in.readAgain(); + c = in.getLastChar(); // empty line detection: eol AND (last char was EOL or beginning) if (ignoreEmptyLines) { @@ -64,7 +64,7 @@ class CSVLexer1306667 extends Lexer { lastChar = c; c = in.read(); eol = isEndOfLine(c); - c = in.readAgain(); + c = in.getLastChar(); // reached end of file without any content (empty line at the end) if (isEndOfFile(c)) { tkn.type = EOF; Modified: commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/ExtendedBufferedReaderTest.java URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/ExtendedBufferedReaderTest.java?rev=1397911&r1=1397910&r2=1397911&view=diff ============================================================================== --- commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/ExtendedBufferedReaderTest.java (original) +++ commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/ExtendedBufferedReaderTest.java Sat Oct 13 17:40:05 2012 @@ -34,7 +34,7 @@ public class ExtendedBufferedReaderTest final ExtendedBufferedReader br = getBufferedReader(""); assertEquals(END_OF_STREAM, br.read()); assertEquals(END_OF_STREAM, br.lookAhead()); - assertEquals(END_OF_STREAM, br.readAgain()); + assertEquals(END_OF_STREAM, br.getLastChar()); assertNull(br.readLine()); assertEquals(0, br.read(new char[10], 0, 0)); } @@ -43,48 +43,48 @@ public class ExtendedBufferedReaderTest public void testReadLookahead1() throws Exception { final ExtendedBufferedReader br = getBufferedReader("1\n2\r3\n"); assertEquals('1', br.lookAhead()); - assertEquals(UNDEFINED, br.readAgain()); + assertEquals(UNDEFINED, br.getLastChar()); assertEquals('1', br.read()); - assertEquals('1', br.readAgain()); + assertEquals('1', br.getLastChar()); assertEquals(0, br.getLineNumber()); assertEquals('\n', br.lookAhead()); assertEquals(0, br.getLineNumber()); - assertEquals('1', br.readAgain()); + assertEquals('1', br.getLastChar()); assertEquals('\n', br.read()); assertEquals(1, br.getLineNumber()); - assertEquals('\n', br.readAgain()); + assertEquals('\n', br.getLastChar()); assertEquals(1, br.getLineNumber()); assertEquals('2', br.lookAhead()); assertEquals(1, br.getLineNumber()); - assertEquals('\n', br.readAgain()); + assertEquals('\n', br.getLastChar()); assertEquals(1, br.getLineNumber()); assertEquals('2', br.read()); - assertEquals('2', br.readAgain()); + assertEquals('2', br.getLastChar()); assertEquals('\r', br.lookAhead()); - assertEquals('2', br.readAgain()); + assertEquals('2', br.getLastChar()); assertEquals('\r', br.read()); - assertEquals('\r', br.readAgain()); + assertEquals('\r', br.getLastChar()); assertEquals('3', br.lookAhead()); - assertEquals('\r', br.readAgain()); + assertEquals('\r', br.getLastChar()); assertEquals('3', br.read()); - assertEquals('3', br.readAgain()); + assertEquals('3', br.getLastChar()); assertEquals('\n', br.lookAhead()); assertEquals(2, br.getLineNumber()); - assertEquals('3', br.readAgain()); + assertEquals('3', br.getLastChar()); assertEquals('\n', br.read()); assertEquals(3, br.getLineNumber()); - assertEquals('\n', br.readAgain()); + assertEquals('\n', br.getLastChar()); assertEquals(3, br.getLineNumber()); assertEquals(END_OF_STREAM, br.lookAhead()); - assertEquals('\n', br.readAgain()); + assertEquals('\n', br.getLastChar()); assertEquals(END_OF_STREAM, br.read()); - assertEquals(END_OF_STREAM, br.readAgain()); + assertEquals(END_OF_STREAM, br.getLastChar()); assertEquals(END_OF_STREAM, br.read()); assertEquals(END_OF_STREAM, br.lookAhead()); @@ -101,13 +101,13 @@ public class ExtendedBufferedReaderTest ref[2] = 'c'; assertEquals(3, br.read(res, 0, 3)); assertArrayEquals(ref, res); - assertEquals('c', br.readAgain()); + assertEquals('c', br.getLastChar()); assertEquals('d', br.lookAhead()); ref[4] = 'd'; assertEquals(1, br.read(res, 4, 1)); assertArrayEquals(ref, res); - assertEquals('d', br.readAgain()); + assertEquals('d', br.getLastChar()); } @Test