Skip to content
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

Add raw value to Tag #601

Open
FilippoVigani opened this issue Jan 18, 2023 · 5 comments
Open

Add raw value to Tag #601

FilippoVigani opened this issue Jan 18, 2023 · 5 comments

Comments

@FilippoVigani
Copy link

It would make sense to add the raw value to the class Tag on top of the already existing human-readable description, the same way that we have the tagType field which is technically the raw value of the human-readable tagName field.

@drewnoakes
Copy link
Owner

getObject should give you that, no?

/**
* Returns the object hashed for the particular tag type specified, if available.
*
* @param tagType the tag type identifier
* @return the tag's value as an Object if available, else <code>null</code>
*/
@java.lang.SuppressWarnings({ "UnnecessaryBoxing" })
@Nullable
public Object getObject(int tagType)
{
return _tagMap.get(Integer.valueOf(tagType));
}

That API comment isn't great, looking at it again.

@FilippoVigani
Copy link
Author

That is kind of what I was looking for, I will admit it was hard to find at first. Maybe improving the documentation would be a good first step. One addition for the raw value would be to add support for retrieving the raw bytes instead of a class-specific object.

@drewnoakes
Copy link
Owner

We don't always hold on to the raw bytes for every tag. That would increase memory consumption.

Could you explain your use case?

@FilippoVigani
Copy link
Author

In my case I would like to have the raw bytes because for a forensic reporting tool they are necessary for re-parsing from third party tools without including the original file. So basically in the report include both human-readable formats and raw formats.

@drewnoakes
Copy link
Owner

There isn't always a 1:1 mapping between tag and byte(s). It'd be helpful to see a concrete example, with specific tags.

necessary for re-parsing from third party tools

Do you mean you need to extract only the metadata, persist it somewhere, then re-parse it later? Depending upon the format, you can do that. For example, take a look at JpegSegmentReader which will give you access to the different JPEG segments. You can then parse them individually at your leisure. What we don't have (and would be hard to add) is a way to map a tag to a specific byte segment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants