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

spec. should explicitly say that read(byte[],int,int) may return -1

XMLWordPrintable

    • beta2
    • generic
    • generic



      Name: mlR10151 Date: 04/19/2001




      According to the spec., the read(byte[],int,int) method in the javax.imageio.stream.ImageInputStreamImpl class:

            "Reads one or more bytes from the stream, up to len, and stores them into b starting at index off.
            The number of bytes read is returned. "

      So, in case of an EOF it returns 0,
      but the read(byte[]) method in the same class, which according to the spec just calls read(b, 0, b.length),
      returns -1 to indicate an EOF.

      Moreover, the spec. for the read(byte[],int,int) method of the FileImageOutputStream class,
      which extends ImageInputStreamImpl, also says that it returns -1 in case of an EOF, and
      therefore contradicts to the ImageInputStreamImpl description.


      The same words apply to the FileImageInputStream class. The spec. for it's read(byte[],int,int) method
      also says nothing about special behavior in case of an EOF.


      ======================================================================

            dricesunw Daniel Rice (Inactive)
            mlsunw Ml Ml (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: