chaolengmian opened a new issue, #985:
URL: https://github.com/apache/poi/issues/985

   When I tried to use `FileMagic.valueOf` to verify whether the 
`PushbackInputStream` file stream was ooxml, I found that it always returned 
false.
   <img width="841" height="228" alt="Image" 
src="https://github.com/user-attachments/assets/b685d98a-50ba-457b-a483-2a48eb1dedad";
 />
   
   So I checked the implementation of `FileMagic.valueOf` and found that it 
internally uses `inp.markSupported()` for verification. `getFileMagic() only 
operates on streams which support mark(int)`
   
   <img width="853" height="210" alt="Image" 
src="https://github.com/user-attachments/assets/6b6be5ea-13ed-4e35-a9fe-19484d77585b";
 />
   
   However, after examining the internal implementation of 
`IOUtils.peekFirstNBytes`, I found that this method supports 
`PushbackInputStream`.
   
   <img width="834" height="209" alt="Image" 
src="https://github.com/user-attachments/assets/8792ccfe-2797-48d0-a04a-b54c35986ed3";
 />
   
   <img width="996" height="667" alt="Image" 
src="https://github.com/user-attachments/assets/d14e53f3-f3c1-45cd-a5a8-e82688ae5c5a";
 />
   
   It is hoped that `FileMagic.valueOf` will support `PushbackInputStream` in 
future versions.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to