How to write my own manifest for a Jar file

  • Thread starter christian.bongiorno
  • Start date
C

christian.bongiorno

Can someone explain to me how it is that I can add values to a manifest
(and subsequently add it to a jar file). I see the part where I can add
it to the jar, but when I look at the Attributes class

the toString() method is not overridded so I have no reason to believe
that the toString() is properly formatted to be added to the
Manifest(InputStream).

it isn't serializable (so it can't go to an OutputStream directly)

Manifest does not take an "Attributes" class as input anywhere I can
see.

So, without cheating and simply hand coding the manifest attributes
strings, how do I tie the attributes in with the manifest?

Is the idea to override the Attributes.toString() method and flush it
to a ByteArrayInputStream()? I am missing the wisdom somewhere.

Christian
http://christian.bongiorno.org/resume.pdf
 
R

Raymond DeCampo

Can someone explain to me how it is that I can add values to a manifest
(and subsequently add it to a jar file). I see the part where I can add
it to the jar, but when I look at the Attributes class

the toString() method is not overridded so I have no reason to believe
that the toString() is properly formatted to be added to the
Manifest(InputStream).

I assume simply using the jar tool is out of the question? :)
it isn't serializable (so it can't go to an OutputStream directly)

Manifest has read() and write() methods.
Manifest does not take an "Attributes" class as input anywhere I can
see.

So, without cheating and simply hand coding the manifest attributes
strings, how do I tie the attributes in with the manifest?

Manifest.getEntries() returns a Map of Strings to Attributes. It is not
clear from the docs, but perhaps you are meant to add entries to the map?
Is the idea to override the Attributes.toString() method and flush it
to a ByteArrayInputStream()? I am missing the wisdom somewhere.

Christian
http://christian.bongiorno.org/resume.pdf

HTH,
Ray
 
R

Roedy Green

Manifest.getEntries() returns a Map of Strings to Attributes. It is not
clear from the docs, but perhaps you are meant to add entries to the map?

if worst comes to worst, you can always revert to ZipFile and brethren
where the manifest is just another member.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top