Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4431446

ByteArrayInputStream spec self-contradictory re: relationship of mark() & offset

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 1.4.0
    • 1.4.0
    • core-libs
    • beta2
    • generic
    • generic
    • Verified

      In the case where an offset is provided to a ByteArrayInputStream constructor, and a reset is performed, where does the read begin from? There are two, mutually exclusive assertions in the spec:

      The spec for the ByteArrayInputStream constructor that takes an offset says:
           "Note that if bytes are simply read from the resulting input stream, elements buf[pos] through buf[pos+len-1] will be read; however, if a reset
            operation is performed, then bytes buf[0] through buf[pos-1] will then
            become available for input."

      Under ByteArrayInputStream.mark() spec it says:
            "If no mark has been set, then the value of the mark is the offset passed to the constructor (or 0 if the offset was not supplied)."

      These two statements directly contradict one another. In the second case the appears to be no way to recover the data in the buffer in front of the offset position, whereas in the first case this seems to be a major thrust of the intended functionality. The first case provides more functionality and is what it looks like the developers really intended.

      The spec. must provide one, clear direction so that the JCK tests can be developed, implementers know what to implement, and Application developers know which behavior to expect.
      marcus.johnson@eng 2001-03-28

            mmcclosksunw Michael Mccloskey (Inactive)
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: