如何在不提取整个文件的情况下更改存档(.ear)文件中的文件 [英] How to change a file inside an archive (.ear) file without extracting entire file

查看:183
本文介绍了如何在不提取整个文件的情况下更改存档(.ear)文件中的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个.ear文件(一个诸如tar/zip之类的存档文件),里面有一个我想要更改的文件.

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

例如myfile.ear包含1.txt,我想将1.txt更改为2.txt,并且可能还更改1.txt内部的某些内容(如sed一样)

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)

我真的想避免提取myfile.ear,更改文件并再次压缩.

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

有人知道在Linux中实现此目标的方法吗?

Does anyone know a way to achieve this in linux ?

如果不可能,我也想知道为什么

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

谢谢.

推荐答案

EAR文件只是JAR文件,而只是ZIP文件. ZIP格式IIRC包含元数据和交错的数据,因此更改一个文件(可能大于或小于要替换的文件)可能不适合(或留有空白),因此,从实际意义上讲,必须重写该文件进行修改时.

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.

这篇关于如何在不提取整个文件的情况下更改存档(.ear)文件中的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆