scijava-common icon indicating copy to clipboard operation
scijava-common copied to clipboard

Bug in WriteBufferDataHandle: cannot seek to file end

Open Daniel-Alievsky opened this issue 1 year ago • 0 comments

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?

Daniel-Alievsky avatar Jun 07 '24 13:06 Daniel-Alievsky