Uploaded image for project: 'Daffodil'
  1. Daffodil
  2. DAFFODIL-1065

parser: API needs to enable repeated calls to parser - not treat unconsumed data as 'left over'

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: s14
    • Fix Version/s: 2.2.0
    • Component/s: API
    • Labels:
      None

      Description

      From an Email thread with James Garriss:

      While I got the workaround working, I definitely think this is an improvement opportunity for your API. It should have simple methods that:

      �� Detect a ���leftover data��� condition.
      �� Return some sort of pointer to the location of the leftover data.
      �� Return the entirety of the leftover data.

      This would be super helpful for anyone trying to use Daffodil in a filter.

      ----Original Message----
      From: Steve Lawrence slawrence@tresys.com
      Sent: Wednesday, October 08, 2014 10:05 AM
      ...
      Subject: Re: Daffodil 0.14 - warning about extra, unprocessed data

      Yep, it looks like our CLI has two ways we determine if there is left
      over data.

      The first is the isAtEnd method. The problem with this is that I think
      it only works if you provide the size of your data to the parse()
      method. Otherwise, it will always return false. This is a bug. However,
      the workaround is to get the size of your input data, and pass it to the
      parse function, e.g.:

      ParseResult pr = processorFactory.parse(input, lengthOfInput)

      The second way is to read the internal state to determine the length of
      the data and compare that with the resulting data location. This is what
      the Scala CLI does when the length isn't known. The problem with this
      method is that it is internal information that is not available via the
      Java API, so while it works for our CLI written in Scala, it can't be
      used in your GUI. I'm not sure this information should be available via
      the API, I think we just need to fix the first bug.

      So the short of it, pass in the length of your data and I think isAtEnd
      will work.

      • Steve

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                slawrence Steve Lawrence
                Reporter:
                mbeckerle Michael Beckerle
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: