Commons CSV
  1. Commons CSV
  2. CSV-25

CSVParser.nextValue() seems pointless

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.0
    • Component/s: Parser
    • Labels:
      None

      Description

      The nextValue method really doesn't seem very useful. There's no concept of end of line, so your csv file could be 1xn or nx1 and you wouldn't know.

        Issue Links

          Activity

          Hide
          Henri Yandell added a comment -

          Digging into the code - I think it returns a string containing a newline of some kind to indicate end of line. It is doing something for end of line, but I imagine it's not much fun to code against. Still thinking the method needs a big overhaul.

          Maybe delete for 1.0 and make it a feature for 1.x.

          Show
          Henri Yandell added a comment - Digging into the code - I think it returns a string containing a newline of some kind to indicate end of line. It is doing something for end of line, but I imagine it's not much fun to code against. Still thinking the method needs a big overhaul. Maybe delete for 1.0 and make it a feature for 1.x.
          Hide
          Bob Smith added a comment -

          It would be useful if the getLineNumber() method returned the current line in the output instead of the current line in the reader (since they would be different if there is a multi-line value). Then you could use that method to tell which line the value is on.

          And if I'm looking at it correctly, the only special value it returns is null when it gets to the end of the file (which would be how you know that there are no more values).

          Show
          Bob Smith added a comment - It would be useful if the getLineNumber() method returned the current line in the output instead of the current line in the reader (since they would be different if there is a multi-line value). Then you could use that method to tell which line the value is on. And if I'm looking at it correctly, the only special value it returns is null when it gets to the end of the file (which would be how you know that there are no more values).
          Hide
          Jacopo Cappellato added a comment -

          I agree that the method doesn't seem very useful; as far as I understand when an end of line is reached the method returns (as the end result of the chain ) an empty string "".
          In this way it is not possible to figure out when a line begins.
          I guess that it can be useful in some special cases, for example when the data in the csv file is structured in a way (for example if the first value of each line has a given prefix) that can be used by the calling method to figure out the new lines.
          This is not probably a big deal and it can be improved in a future release.

          Show
          Jacopo Cappellato added a comment - I agree that the method doesn't seem very useful; as far as I understand when an end of line is reached the method returns (as the end result of the chain ) an empty string "". In this way it is not possible to figure out when a line begins. I guess that it can be useful in some special cases, for example when the data in the csv file is structured in a way (for example if the first value of each line has a given prefix) that can be used by the calling method to figure out the new lines. This is not probably a big deal and it can be improved in a future release.
          Hide
          Emmanuel Bourg added a comment -

          I agree as well, unless lines are too long to fit in memory there is no point keeping this method.

          Show
          Emmanuel Bourg added a comment - I agree as well, unless lines are too long to fit in memory there is no point keeping this method.

            People

            • Assignee:
              Unassigned
              Reporter:
              Henri Yandell
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development