Uploaded image for project: 'Commons CSV'
  1. Commons CSV
  2. CSV-155

Get remaining unformatted text

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 1.1
    • None
    • Parser
    • None

    Description

      I have the requirement where I need to parse the headers of a CSV string so that I can validate them and then remove those headers.

      The problem is that the CSVParser creates an internal ExtendedBufferedReader from the given reader (which in my case is a StringReader). Reading the first record will read and buffer additional records so if I then try and read directly from the StringReader it does not return anything.

      To solve this I need to be able to do one of the following:

      1. pass in my own ExtendedBufferedReader (so would need to be made public)
      2. have a new getter method to be able to retrieve the internal ExtendedBufferedReader (or as a BufferedReader, either will do)
      3. have a new method on the CSVParser to be able to retrieve the remaining raw records.

      The current workaround is to read all the records and then write all the records except the first back out to a StringWriter but this is a lot of unnecessary work and code. This doesn't really work since it reader and writing it back out has a very high chance of modifying the quotes, escapes, whitespace etc.

      Attachments

        1. CSV-155.patch
          5 kB
          Jason Steenstra-Pickens

        Activity

          People

            Unassigned Unassigned
            Steiny69 Jason Steenstra-Pickens
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: