imageio-ext
  1. imageio-ext
  2. IMAGEIO_EXT-23

EnhancedRandomAccessFile leaves endOfFile true

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.0.8
    • Fix Version/s: 1.2-M0, 1.1.0
    • Component/s: customstreams
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

    • Issuezilla Id:
      23

      Description

      If the EnhancedRandomAccessFile ever reaches the end of the file, an instance
      boolean called 'endOfFile' is set true to allow faster determination of end of
      file than comparison with long pointer values that are not always easily
      derived. That's fine. However, once the value becomes true, if the user seeks
      backward in the file a small distance such that the seek is within the currently
      buffered portion of the file, then the endOfFile bit is not reset.

      The following patch is an 'svn diff' from the root of the streams module. It
      resolves the issue by clearing endOfFile when seeking to a file position within
      the loaded buffer:

      Index:
      src/main/java/it/geosolutions/imageio/stream/eraf/EnhancedRandomAccessFile.java
      ===================================================================

      src/main/java/it/geosolutions/imageio/stream/eraf/EnhancedRandomAccessFile.java
      (revision 1233)
      +++
      src/main/java/it/geosolutions/imageio/stream/eraf/EnhancedRandomAccessFile.java
      (working copy)
      @@ -300,6 +300,7 @@
      // If the seek is into the buffer, just update the eraf pointer.
      if ((pos >= bufferStart) && (pos < dataEnd))

      { filePosition = pos; + endOfFile = false; return; }

      Please let me know if I can do anything else to speed along the inclusion of
      this patch. Thanks! -Eric

        Activity

        Hide
        dany111 added a comment -

        Fixed on both 1.1.x and trunk

        Show
        dany111 added a comment - Fixed on both 1.1.x and trunk

          People

          • Assignee:
            dany111
            Reporter:
            pentath
          • Votes:
            2 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: