I am getting input stream of the uploaded file in my application and I need to fetch the metadata of this file and process it. Is there anyway to get the metadata from Input stream, using java?
Thanks.
I am getting input stream of the uploaded file in my application and I need to fetch the metadata of this file and process it. Is there anyway to get the metadata from Input stream, using java?
Thanks.
You can't get filesystem-level metadata (what you see when you right-click on a file in Explorer and select Properties) from an InputStream
; you need to know the filename. As for files being uploaded in an HTTP POST request, Maurice Perry's comment is right (it's impossible to get the filesystem-level metadata, as the client doesn't send them).
However, if you are talking about e.g. Office documents, you can get the metadata because they are contained in the file data itself, but you'd need to use a library that can read such files. For Microsoft Office, check out Apache POI.