开发者

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

开发者 https://www.devze.com 2023-03-12 08:37 出处:网络
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 s

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开发者_高级运维.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号