aQute.lib.osgi

Class Jar

public class Jar extends Object implements Closeable

Field Summary
static Object[]EMPTY_ARRAY
Constructor Summary
Jar(String name)
Jar(String name, File dirOrFile)
Jar(String name, InputStream in, long lastModified)
Jar(String name, String path)
Jar(File jar)
Jar(String string, InputStream resourceAsStream)
Method Summary
booleanaddAll(Jar sub, Pattern filter)
Add all the resources in the given jar that match the given filter.
booleanaddAll(Jar src)
booleanaddDirectory(Map<String,Resource> directory, boolean overwrite)
voidclose()
booleanexists(String path)
Map<String,Map<String,Resource>>getDirectories()
ManifestgetManifest()
StringgetName()
List<String>getPackages()
ResourcegetResource(String path)
Map<String,Resource>getResources()
FilegetSource()
booleanhasDirectory(String path)
longlastModified()
booleanputResource(String path, Resource resource)
booleanputResource(String path, Resource resource, boolean overwrite)
Resourceremove(String path)
booleanrename(String oldPath, String newPath)
voidsetDoNotTouchManifest()
Make sure nobody touches the manifest!
voidsetManifest(Manifest manifest)
voidsetName(String name)
voidsetNoManifest(boolean b)
voidsetReporter(Reporter reporter)
StringtoString()
voidupdateModified(long time, String reason)
voidwrite(File file)
voidwrite(String file)
voidwrite(OutputStream out)
voidwriteManifest(OutputStream out)
Cleanup the manifest for writing.
static voidwriteManifest(Manifest manifest, OutputStream out)

Field Detail

EMPTY_ARRAY

public static final Object[] EMPTY_ARRAY

Constructor Detail

Jar

public Jar(String name)

Jar

public Jar(String name, File dirOrFile)

Jar

public Jar(String name, InputStream in, long lastModified)

Jar

public Jar(String name, String path)

Jar

public Jar(File jar)

Jar

public Jar(String string, InputStream resourceAsStream)

Method Detail

addAll

public boolean addAll(Jar sub, Pattern filter)
Add all the resources in the given jar that match the given filter.

Parameters: sub the jar filter a pattern that should match the resoures in sub to be added

addAll

public boolean addAll(Jar src)

addDirectory

public boolean addDirectory(Map<String,Resource> directory, boolean overwrite)

close

public void close()

exists

public boolean exists(String path)

getDirectories

public Map<String,Map<String,Resource>> getDirectories()

getManifest

public Manifest getManifest()

getName

public String getName()

getPackages

public List<String> getPackages()

getResource

public Resource getResource(String path)

getResources

public Map<String,Resource> getResources()

getSource

public File getSource()

hasDirectory

public boolean hasDirectory(String path)

lastModified

public long lastModified()

putResource

public boolean putResource(String path, Resource resource)

putResource

public boolean putResource(String path, Resource resource, boolean overwrite)

remove

public Resource remove(String path)

rename

public boolean rename(String oldPath, String newPath)

setDoNotTouchManifest

public 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.

setManifest

public void setManifest(Manifest manifest)

setName

public void setName(String name)

setNoManifest

public void setNoManifest(boolean b)

setReporter

public void setReporter(Reporter reporter)

toString

public String toString()

updateModified

public void updateModified(long time, String reason)

write

public void write(File file)

write

public void write(String file)

write

public void write(OutputStream out)

writeManifest

public void writeManifest(OutputStream out)
Cleanup the manifest for writing. Cleaning up consists of adding a space after any \n to prevent the manifest to see this newline as a delimiter.

Parameters: out Output

Throws: IOException

writeManifest

public static void writeManifest(Manifest manifest, OutputStream out)