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

FileImageInputStream.length() does not return -1 as declared

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      beta2
    • CPU:
      generic
    • OS:
      generic

      Description



      Name: mlR10151 Date: 04/10/2001



      According to the spec.
      public long length()
       . . .
      Returns -1L to indicate that the stream has unknown length.

      But it returns actual length of the stream:
      ===================== a.java =======================
      import java.io.*;
      import javax.imageio.stream.*;

      public class a {
          public static void main (String argv[]) throws Exception {
              File f = File.createTempFile("tmp", "tmp");
              FileImageInputStream fiis = new FileImageInputStream(f);
              long len = fiis.length();
              System.out.println( (len == -1 ? "Passed" : "Failed") + ", len = " + len );
          }
      }
      ===================== log =======================
      java version "1.4.0-beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta-b59)
      Java HotSpot(TM) Client VM (build 1.4.0-beta-b59, mixed mode)
      % java a
      Failed, len = 0

      It's probably a spec. bug.

      This bug causes failure of the new JCK test
      api/javax_imageio/stream/FileImageInputStream/index.html#length


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

        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: