How to change a file inside an archive (.ear) file without extracting entire file

萝らか妹 提交于 2020-01-16 04:09:05

问题


I have an .ear file (an archive file like tar / zip) that has a file inside that i want to change.

For example myfile.ear contains 1.txt and i want to change 1.txt to 2.txt and possibly also change some of the content inside 1.txt (like sed does)

I really want to avoid having to extract myfile.ear, change the file and compress it again.

Does anyone know a way to achieve this in linux ?

And if it's not possible, I would also like to know why

Thanks.


回答1:


EAR files are just JAR files which are just ZIP files. The ZIP format, IIRC, contains metadata and data interleaved, so changing one file (which might be larger/smaller than the file it is replacing) might not fit (or leave a gap), thus in all practical terms the file must be rewritten when doing modifications.



来源:https://stackoverflow.com/questions/6334037/how-to-change-a-file-inside-an-archive-ear-file-without-extracting-entire-fil

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!