use of java.util.jar.Manifest in project felix by apache.
the class BootLoaderTest method createBundle.
private static File createBundle(String manifest) throws IOException {
File f = File.createTempFile("felix-bundle", ".jar");
f.deleteOnExit();
Manifest mf = new Manifest(new ByteArrayInputStream(manifest.getBytes("utf-8")));
mf.getMainAttributes().putValue("Manifest-Version", "1.0");
JarOutputStream os = new JarOutputStream(new FileOutputStream(f), mf);
os.close();
return f;
}
use of java.util.jar.Manifest in project felix by apache.
the class CycleDetectionWithWovenClassTest method createBundle.
private static File createBundle(String manifest, Class... classes) throws IOException {
File f = File.createTempFile("felix-bundle", ".jar");
f.deleteOnExit();
Manifest mf = new Manifest(new ByteArrayInputStream(manifest.getBytes("utf-8")));
JarOutputStream os = new JarOutputStream(new FileOutputStream(f), mf);
for (Class clazz : classes) {
String path = clazz.getName().replace('.', '/') + ".class";
os.putNextEntry(new ZipEntry(path));
InputStream is = clazz.getClassLoader().getResourceAsStream(path);
byte[] buffer = new byte[8 * 1024];
for (int i = is.read(buffer); i != -1; i = is.read(buffer)) {
os.write(buffer, 0, i);
}
is.close();
os.closeEntry();
}
os.close();
return f;
}
use of java.util.jar.Manifest in project felix by apache.
the class DTOFactoryTest method createBundle.
private File createBundle(String manifest) throws IOException {
File f = File.createTempFile("felix-bundle" + counter++, ".jar", testDir);
Manifest mf = new Manifest(new ByteArrayInputStream(manifest.getBytes("utf-8")));
mf.getMainAttributes().putValue("Manifest-Version", "1.0");
JarOutputStream os = new JarOutputStream(new FileOutputStream(f), mf);
os.close();
return f;
}
use of java.util.jar.Manifest in project felix by apache.
the class ExtensionManagerTest method createExtensionBundle.
private File createExtensionBundle() throws IOException {
File f = File.createTempFile("felix-bundle" + counter++, ".jar", testDir);
Manifest mf = new Manifest();
mf.getMainAttributes().putValue("Manifest-Version", "1.0");
mf.getMainAttributes().putValue(Constants.BUNDLE_SYMBOLICNAME, "extension-bundle");
mf.getMainAttributes().putValue(Constants.BUNDLE_VERSION, "3.2.1");
mf.getMainAttributes().putValue(Constants.FRAGMENT_HOST, "system.bundle;extension:=framework");
mf.getMainAttributes().putValue(Constants.BUNDLE_MANIFESTVERSION, "2");
mf.getMainAttributes().putValue(Constants.EXTENSION_BUNDLE_ACTIVATOR, TestActivator.class.getName());
JarOutputStream os = new JarOutputStream(new FileOutputStream(f), mf);
String path = TestActivator.class.getName().replace('.', '/') + ".class";
os.putNextEntry(new ZipEntry(path));
InputStream is = TestActivator.class.getClassLoader().getResourceAsStream(path);
pumpStreams(is, os);
is.close();
os.close();
return f;
}
use of java.util.jar.Manifest in project felix by apache.
the class ImplicitBootDelegationTest method createBundle.
private static File createBundle(String manifest, Class... classes) throws IOException {
File f = File.createTempFile("felix-bundle", ".jar");
f.deleteOnExit();
Manifest mf = new Manifest(new ByteArrayInputStream(manifest.getBytes("utf-8")));
JarOutputStream os = new JarOutputStream(new FileOutputStream(f), mf);
for (Class clazz : classes) {
String path = clazz.getName().replace('.', '/') + ".class";
os.putNextEntry(new ZipEntry(path));
InputStream is = clazz.getClassLoader().getResourceAsStream(path);
byte[] buffer = new byte[8 * 1024];
for (int i = is.read(buffer); i != -1; i = is.read(buffer)) {
os.write(buffer, 0, i);
}
is.close();
os.closeEntry();
}
os.close();
return f;
}
Aggregations