-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MemoReader.read() method reading from wrong location #37
Comments
Hello @wescleveland56. For a similar issue with
|
hi @jferard. Without In my opinion, having |
Ok @wescleveland56, it's true that there is a risk of endless loop if you remove the condition It's clear that the current poor man's
I'm not familiar with memo file sizes. Let's assume that we don't want to store memo files in memory. I think there is no reason to try to emulate a random access file with a sequential access file. All we need is there: https://docs.oracle.com/javase/7/docs/api/java/io/RandomAccessFile.html. For speed, one may use a cache. |
@jferard I agree true random access would be the better approach. BTW, thanks to you and the rest of the jdbf development team for all your work on jdbf. It's the best Java DBase/FoxBase interface I've found. |
Unfortunately, I'm not a member of the team. I agree that jdbf is a very good library, and I have some ideas to improve it, but @iryndin is the only master on board and he doesn't respond since January 29... |
I have a Visual FoxPro dbf with fpt that results in the process being halted with no error message during MemoReader.read() processing as part of the DbfRecord.getMemoAsString() call. After some debugging, I have discovered that the InputStream.skip() call below was only skipping 8192 bytes instead of the number of bytes requested.
memoInputStream.skip(memoHeader.getBlockSize()*offsetInBlocks);
According to documentation at https://docs.oracle.com/javase/8/docs/api/java/io/InputStream.html#skip-long- the InputStream.skip() method may skip fewer bytes than requested:
My workaround was to add a new method in IOUtils:
and then replace the above MemoReader.read() line with:
IOUtils.inputStreamSkip( memoInputStream, memoHeader.getBlockSize()*offsetInBlocks );
I have also experienced similar behavior with the DbfReader.seek() method but didn't know why until now. I suspect that all InputStream.skip() calls could potentially suffer from this same issue.
The text was updated successfully, but these errors were encountered: