-
Notifications
You must be signed in to change notification settings - Fork 241
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
TiffSaver: add overwriteIFDValue signature that takes an IFD offset #3410
TiffSaver: add overwriteIFDValue signature that takes an IFD offset #3410
Conversation
This is helpful for modifying thumbnail and sub-IFDs, which aren't included in the list of offsets returned by TiffParser.getIFDOffsets().
public void overwriteIFDValue(RandomAccessInputStream raf, | ||
long ifdOffset, int tag, Object value) throws FormatException, IOException | ||
{ | ||
raf.seek(0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With this refactoring, does that mean any call to the current overwriteIFDValue(RandomAccessInputStream, int, int, Object)
API will now perform a redundant check on the first IFD?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The header will be checked twice, yes. Could refactor further to add a overwriteIFDValue(RandomAccessInputStream, long, int, Object, boolean skipHeaderCheck)
? Otherwise not sure of a good and safe way to skip that check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we're introducing new API anyways, I think introducing
public void overwriteIFDValue(RandomAccessInputStream raf, long ifdOffset, int tag, Object value, boolean skipskipHeaderCheck)
is acceptable. From there both public void overwriteIFDValue(RandomAccessInputStream raf, long ifdOffset, int tag, Object value)
and public void overwriteIFDValue(RandomAccessInputStream raf, int ifd, int tag, Object value)
can delegate to this API by passing the appropriate boolean value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added in b43e748
With the latest update to add The existing unit tests, repo tests and workflows are unaffected by the changes. I reran some local tests using the |
Backported from a private PR.
This is helpful for modifying thumbnail and sub-IFDs, which aren't
included in the list of offsets returned by
TiffParser.getIFDOffsets()
.I wouldn't expect this to have any impact on memo files or existing tests, but it arguably still requires a minor release since it's an API addition.