Removed CSVParser.nextValue() (SANDBOX-220)

git-svn-id: https://svn.apache.org/repos/asf/commons/sandbox/csv/trunk@1199780 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Emmanuel Bourg 2011-11-09 14:54:05 +00:00
parent d90fa381c4
commit fc4ccb426e
2 changed files with 0 additions and 56 deletions

View File

@ -165,35 +165,6 @@ public class CSVParser {
return ret;
}
/**
* Parses the CSV according to the given strategy
* and returns the next csv-value as string.
*
* @return next value in the input stream ('null' when end of file)
* @throws IOException on parse error or input read-failure
*/
public String nextValue() throws IOException {
Token tkn = nextToken();
String ret = null;
switch (tkn.type) {
case TT_TOKEN:
case TT_EORECORD:
ret = tkn.content.toString();
break;
case TT_EOF:
ret = null;
break;
case TT_INVALID:
default:
// error no token available (or error)
throw new IOException(
"(line " + getLineNumber()
+ ") invalid parse sequence");
// unreachable: break;
}
return ret;
}
/**
* Parses from the current point in the stream til
* the end of the current line.

View File

@ -221,19 +221,6 @@ public class CSVParserTest extends TestCase {
assertTrue(tmp == null);
}
public void testNextValue() throws IOException {
CSVParser parser = new CSVParser(new StringReader(code));
String tmp = null;
for (int i = 0; i < res.length; i++) {
for (int j = 0; j < res[i].length; j++) {
tmp = parser.nextValue();
assertEquals(res[i][j], tmp);
}
}
tmp = parser.nextValue();
assertTrue(tmp == null);
}
public void testGetAllValues() throws IOException {
CSVParser parser = new CSVParser(new StringReader(code));
String[][] tmp = parser.getAllValues();
@ -571,20 +558,6 @@ public class CSVParserTest extends TestCase {
assertEquals(3, data.length);
}
public void testLineTokenConsistency() throws IOException {
String code = "\nfoo,baar\n\r\n,\n\n,world\r\n\n";
CSVParser parser = new CSVParser(new StringReader(code));
String[][] data = parser.getAllValues();
parser = new CSVParser(new StringReader(code));
CSVParser parser1 = new CSVParser(new StringReader(code));
for (int i = 0; i < data.length; i++) {
assertTrue(Arrays.equals(parser1.getLine(), data[i]));
for (int j = 0; j < data[i].length; j++) {
assertEquals(parser.nextValue(), data[i][j]);
}
}
}
// From SANDBOX-153
public void testDelimiterIsWhitespace() throws IOException {
String code = "one\ttwo\t\tfour \t five\t six";