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

java.io.RandomAccessFile.read returns 0 instead of -1 on EOF

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • None
    • 1.1.1
    • core-libs
    • None
    • generic
    • generic

      Date: Thu, 24 Jul 1997 16:11:42 +0200
      From: ###@###.### (Friedhelm Kunkel)
      To: ###@###.###
      Subject: read with RandomAccessFile delivers 0 instead of -1 at EOF

      When I open a file with the FileInputStream, the "read" gives me a "-1"
      if reach EOF.

      When I open a file with RandomAccessFile and "r" (maybe also "rw") , the
      "data_read = fis.read(data, 0, TRY_COUNT) gives me a "0" if I reach
      EOF and not
      "-1", I would expect. This could lead to endless loops in file handling.
      Maybe
      this is an error of the jdk1.1.1, I use. This behaviour is independent of
      Solaris or NT.

            mr Mark Reinhold
            mr Mark Reinhold
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: