public class Jar extends Object implements Closeable
Modifier and Type | Field and Description |
---|---|
static Object[] |
EMPTY_ARRAY |
Constructor and Description |
---|
Jar(File f) |
Jar(String name) |
Jar(String string,
File file) |
Jar(String name,
File dirOrFile,
Pattern doNotCopy) |
Jar(String string,
InputStream resourceAsStream) |
Jar(String name,
InputStream in,
long lastModified) |
Jar(String name,
String path) |
Modifier and Type | Method and Description |
---|---|
boolean |
addAll(Jar src) |
boolean |
addAll(Jar sub,
Instruction filter)
Add all the resources in the given jar that match the given filter.
|
boolean |
addAll(Jar sub,
Instruction filter,
String destination)
Add all the resources in the given jar that match the given filter.
|
boolean |
addDirectory(Map<String,Resource> directory,
boolean overwrite) |
void |
calcChecksums(String[] algorithms)
Calculate the checksums and set them in the manifest.
|
void |
close() |
void |
ensureManifest()
Make sure we have a manifest
|
boolean |
exists(String path) |
void |
expand(File dir)
Expand the JAR file to a directory.
|
String |
getBsn() |
Map<String,Map<String,Resource>> |
getDirectories() |
Manifest |
getManifest() |
String |
getName() |
List<String> |
getPackages() |
Resource |
getResource(String path) |
Map<String,Resource> |
getResources() |
File |
getSource() |
String |
getVersion() |
boolean |
hasDirectory(String path) |
long |
lastModified() |
static void |
outputManifest(Manifest manifest,
OutputStream out)
Main function to output a manifest properly in UTF-8.
|
boolean |
putResource(String path,
Resource resource) |
boolean |
putResource(String path,
Resource resource,
boolean overwrite) |
Resource |
remove(String path) |
boolean |
rename(String oldPath,
String newPath) |
void |
setDoNotTouchManifest()
Make sure nobody touches the manifest! If the bundle is signed, we do not
want anybody to touch the manifest after the digests have been
calculated.
|
void |
setManifest(Manifest manifest) |
void |
setName(String name) |
void |
setReporter(Reporter reporter) |
String |
toString() |
void |
updateModified(long time,
String reason) |
void |
write(File file) |
void |
write(OutputStream out) |
void |
write(String file) |
static void |
writeManifest(Manifest manifest,
OutputStream out) |
void |
writeManifest(OutputStream out)
Cleanup the manifest for writing.
|
public static final Object[] EMPTY_ARRAY
public Jar(String name)
public Jar(String name, File dirOrFile, Pattern doNotCopy) throws ZipException, IOException
ZipException
IOException
public Jar(String name, InputStream in, long lastModified) throws IOException
IOException
public Jar(String name, String path) throws IOException
IOException
public Jar(File f) throws IOException
IOException
public Jar(String string, InputStream resourceAsStream) throws IOException
IOException
public Jar(String string, File file) throws ZipException, IOException
ZipException
IOException
public void setName(String name)
public boolean exists(String path)
public void setManifest(Manifest manifest)
public void write(OutputStream out) throws Exception
Exception
public void writeManifest(OutputStream out) throws Exception
out
- OutputIOException
Exception
public static void writeManifest(Manifest manifest, OutputStream out) throws IOException
IOException
public static void outputManifest(Manifest manifest, OutputStream out) throws IOException
manifest
- The manifest to outputout
- The output streamIOException
- when something failspublic String getName()
public boolean addAll(Jar sub, Instruction filter)
sub
- the jarfilter
- a pattern that should match the resoures in sub to be addedpublic boolean addAll(Jar sub, Instruction filter, String destination)
sub
- the jarfilter
- a pattern that should match the resoures in sub to be addedpublic void close()
close
in interface Closeable
close
in interface AutoCloseable
public long lastModified()
public void updateModified(long time, String reason)
public void setReporter(Reporter reporter)
public boolean hasDirectory(String path)
public File getSource()
public boolean addAll(Jar src)
public void setDoNotTouchManifest()
public void calcChecksums(String[] algorithms) throws Exception
Exception
public void expand(File dir) throws Exception
dir
- the dst directory, is not required to existException
- if anything does not work as expected.Copyright © 2014 aQute SARL. All Rights Reserved.