Redian新闻
>
How to delete an entry in JAR?
avatar
How to delete an entry in JAR?# Java - 爪哇娇娃
j*i
1
而且还卸载不了。
然后胡总收到马化腾通牒“你要么要我,要么要360”。
胡宗感觉一定很爽
avatar
F*n
2
Believe it or not, this is incrediably difficult in Java. The only solution I
found is to copy the whole file, which is so stupid.
avatar
c*g
3
I think you can somehow use the manifest-file, not sure never did this.

【在 F****n 的大作中提到】
: Believe it or not, this is incrediably difficult in Java. The only solution I
: found is to copy the whole file, which is so stupid.

avatar
st
4
what do you mean? it's just a zip file.. delete what entry?

【在 F****n 的大作中提到】
: Believe it or not, this is incrediably difficult in Java. The only solution I
: found is to copy the whole file, which is so stupid.

avatar
F*n
5
An entry is a file or folder in a zip file. Seems it is impossible to append,
modify or delete the content of a zip except create a new copy of the whole
file.

solution I

【在 st 的大作中提到】
: what do you mean? it's just a zip file.. delete what entry?
avatar
st
6
well, some will allow the operation, but actually create new file for you...
what ever... zip is not for edit....

【在 F****n 的大作中提到】
: An entry is a file or folder in a zip file. Seems it is impossible to append,
: modify or delete the content of a zip except create a new copy of the whole
: file.
:
: solution I

avatar
F*n
7

So why you can add / delete files using winzip?
append,
whole

【在 st 的大作中提到】
: well, some will allow the operation, but actually create new file for you...
: what ever... zip is not for edit....

avatar
st
8
I think winzip uncompress file and compress them back.
btw, jar can be compressed or uncompressed, compressed format is just zip,
(some software might create weird zip), you can associate .jar with winzip,
or rename the file to .zip.

【在 F****n 的大作中提到】
:
: So why you can add / delete files using winzip?
: append,
: whole

avatar
e*g
9
i'll take your word for it, and try to justify that it's not so stupid.
however if it turns out that jar API does do it, then it's your fault:)
if you want to remove one node from an XML file, and you want to use the
'ellegantly designed user friendly' DOM/SAX API, you have to read the whole
thing, change the structure in memory/on the fly, and serialize it to a
new file.
so same thing here for jar. the API is designed to be source/target
agnostic, it does not (want to) concern itself with featu

【在 F****n 的大作中提到】
: Believe it or not, this is incrediably difficult in Java. The only solution I
: found is to copy the whole file, which is so stupid.

avatar
st
10
that's not his point, at all.

【在 e***g 的大作中提到】
: i'll take your word for it, and try to justify that it's not so stupid.
: however if it turns out that jar API does do it, then it's your fault:)
: if you want to remove one node from an XML file, and you want to use the
: 'ellegantly designed user friendly' DOM/SAX API, you have to read the whole
: thing, change the structure in memory/on the fly, and serialize it to a
: new file.
: so same thing here for jar. the API is designed to be source/target
: agnostic, it does not (want to) concern itself with featu

avatar
xt
11

I
Try,
1) winzip, if you are deleting an entry without programming;
2) java.util.zip

【在 F****n 的大作中提到】
: Believe it or not, this is incrediably difficult in Java. The only solution I
: found is to copy the whole file, which is so stupid.

avatar
xt
12

append,
Now you make me wonder if you really a Computer Skience major. hehe

【在 F****n 的大作中提到】
: An entry is a file or folder in a zip file. Seems it is impossible to append,
: modify or delete the content of a zip except create a new copy of the whole
: file.
:
: solution I

avatar
F*n
13
You must be kidding, you mean if I have a 100mb zip file (it is usual in many
case) and I want to add or delete one file from it, I need to copy the whole
100mb content? That's ridiculous.

you...

【在 st 的大作中提到】
: I think winzip uncompress file and compress them back.
: btw, jar can be compressed or uncompressed, compressed format is just zip,
: (some software might create weird zip), you can associate .jar with winzip,
: or rename the file to .zip.

avatar
st
14
try it with winzip, I saw the temp file created there.. with similar
size.. so if you want to do that on a 100mb zip, winzip would do such
stupid thing for you. it's ridiculous but I am not kidding.

【在 F****n 的大作中提到】
: You must be kidding, you mean if I have a 100mb zip file (it is usual in many
: case) and I want to add or delete one file from it, I need to copy the whole
: 100mb content? That's ridiculous.
:
: you...

avatar
F*n
15
Both of your points doesnot make since. At least up to JDK1.4.2, it is
impossible using java.util.zip. I am not kidding, probably my experience with
this package is much more than most people on this board.

solution

【在 xt 的大作中提到】
:
: append,
: Now you make me wonder if you really a Computer Skience major. hehe

avatar
B*N
16
why impossible?

with

【在 F****n 的大作中提到】
: Both of your points doesnot make since. At least up to JDK1.4.2, it is
: impossible using java.util.zip. I am not kidding, probably my experience with
: this package is much more than most people on this board.
:
: solution

avatar
F*n
17
Look at the API yourself.

【在 B******N 的大作中提到】
: why impossible?
:
: with

avatar
B*N
18
i am about to use it today or tomorrow.

【在 F****n 的大作中提到】
: Look at the API yourself.
avatar
F*n
19
If you just need to read or copy it, its OK,
otherwise, you have to use the stupid techniques I have used.

experience

【在 B******N 的大作中提到】
: i am about to use it today or tomorrow.
相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。