scijava / scijava-common

A plugin framework and application container with built-in extensibility mechanism :electric_plug:
BSD 2-Clause "Simplified" License
91 stars 52 forks source link

Bug in WriteBufferDataHandle: cannot seek to file end #478

Open Daniel-Alievsky opened 5 months ago

Daniel-Alievsky commented 5 months ago

I tried to use WriteBufferDataHandle for optimizing writing TIFF, but it cannot be used: the simplest call out.seek(out.length()) (for writing to the end of the existing file) does not work. Just see your code:

    public void seek(final long pos) throws IOException {
        ensureOpen();
        if (pos >= length()) { //!!!!!
            throw new EOFException();
        }
        flush();
        offset = pos;
        handle().seek(offset);
    }

By the way, can we be sure that this class will work right while random access usage, togethter with any calls of seek method?