Package java.util.jar

Examples of java.util.jar.JarInputStream


        }
        return false;
    }       
   
  protected void loadByteCode(InputStream is, String jar, String tmp) throws IOException {
        JarInputStream jis = new JarInputStream(is);
        JarEntry entry = null;
        // TODO: implement lazy loading of bytecode.
        Manifest manifest = jis.getManifest();
        if (manifest == null) {
            LOGGER.warning("Null manifest from input stream associated with: " + jar);
        }
        while ((entry = jis.getNextJarEntry()) != null) {
            // if (entry.isDirectory()) continue;
            loadBytes(entry, jis, jar, tmp, manifest);
        }
        // Add in a fake manifest entry.
        if (manifest != null) {
View Full Code Here


      // main directory.  There should be only one, and it's manifest
      // Main-Class attribute is the main class.  The JarClassLoader will take
      // care of finding it.
      InputStream is = Boot.class.getResourceAsStream("/" + mainJar);
      if (is != null) {
        JarInputStream jis = new JarInputStream(is);
        Manifest mainmanifest = jis.getManifest();
                jis.close();
        mainClass = mainmanifest.getMainAttributes().getValue(Attributes.Name.MAIN_CLASS);
      } else {
          // There is no main jar. Info unless mainJar is empty string. 
          // The load(mainClass) will scan for main jars anyway.
        if (!"".equals(mainJar)){
                    LOGGER.info("Unable to locate main jar '" + mainJar + "' in the JAR file " + getMyJarPath());
        }
      }
    }
 
    // Do we need to create a wrapping classloader?  Check for the
    // presence of a "wrap" directory at the top of the jar file.
    URL url = Boot.class.getResource(WRAP_JAR);
   
    if (url != null) {
      // Wrap class loaders.
            final JarClassLoader bootLoader = getBootLoader(bootLoaderName);
      bootLoader.load(null);
     
      // Read the "Wrap-Class-Loader" property from the wraploader jar file.
      // This is the class to use as a wrapping class-loader.
            InputStream is = Boot.class.getResourceAsStream(WRAP_JAR);
            if (is != null) {
          JarInputStream jis = new JarInputStream(is);
          final String wrapLoader = jis.getManifest().getMainAttributes().getValue(WRAP_CLASS_LOADER);
                jis.close();
          if (wrapLoader == null) {
            LOGGER.warning(url + " did not contain a " + WRAP_CLASS_LOADER + " attribute, unable to load wrapping classloader");
          } else {
            LOGGER.info("using " + wrapLoader);
                    JarClassLoader wrapped = getWrapLoader(bootLoader, wrapLoader);
View Full Code Here

                        } catch (IOException iox) {
                            // Ignore..., but it isn't good to have bad entries on the classpath.
                            continue;
                        }
                    }
                    ZipEntry entry = findJarEntry(new JarInputStream(is), Boot.class.getName().replace('.', '/') + ".class");
                    if (entry != null) {
                        myJarPath = jarname;
                        break;
                    } else {
                        // One more try as a Zip file: supports launch4j on Windows.
View Full Code Here

        // Show some info about the plugin.
        displayPluginInfo();

        JarOutputStream out = null;
        JarInputStream template = null;
        File onejarFile = null;
        try {
          // Create the target file
            onejarFile = new File(outputDirectory, filename);
View Full Code Here

        return "one-jar-boot-" + onejarVersion + ".jar";
    }

    private JarInputStream openOnejarTemplateArchive() throws IOException {
      if (localOneJarTemplate != null) {
        return new JarInputStream(new FileInputStream(new File(project.getBasedir(), localOneJarTemplate)));
      } else {     
        return new JarInputStream(getClass().getClassLoader().getResourceAsStream(getOnejarArchiveName()));
      }
    }
View Full Code Here

     * @throws FileNotFoundException
     * @throws IOException
     */
    private static void mergeJar(JarOutputStream jarFile, String jar, String prefix, Map<String, String> contents)
            throws FileNotFoundException, IOException {
        JarInputStream jarInput = new JarInputStream(new FileInputStream(jar));
       
        mergeJar(jarFile, jarInput, prefix, contents);
    }
View Full Code Here

        mergeJar(jarFile, jarInput, prefix, contents);
    }
   
    private static void mergeJar(JarOutputStream jarFile, URL jar, String prefix, Map<String, String> contents)
    throws FileNotFoundException, IOException {
        JarInputStream jarInput = new JarInputStream(jar.openStream());

        mergeJar(jarFile, jarInput, prefix, contents);
    }
View Full Code Here

    private static Messages messages = new Messages("org.apache.openejb.util.resources");

    public static void addFileToJar(String jarFile, String file) throws OpenEJBException {
        try {
            JarInputStream jis = new JarInputStream(new FileInputStream(jarFile));
            File tempJar = File.createTempFile("temp", "jar");
            JarOutputStream jos = new JarOutputStream(new FileOutputStream(tempJar));
            JarEntry nextJarEntry = null;
            while ((nextJarEntry = jis.getNextJarEntry()) != null) {
                jos.putNextEntry(nextJarEntry);
            }
            jis.close();
            jos.putNextEntry(new JarEntry(file));
            FileInputStream fis = new FileInputStream(file);
            for (int c = fis.read(); c != -1; c = fis.read()) {
                jos.write(c);
            }
View Full Code Here

            jarPath = jarPath.substring(0, jarPath.indexOf("!"));
        }
        URL url = new URL(jarPath);
        InputStream in = url.openStream();
        try {
            JarInputStream jarStream = new JarInputStream(in);
            return jar(jarStream);
        } finally {
            in.close();
        }
    }
View Full Code Here

     */
    private static Manifest getManifest(InputStream inStream)
            throws IOException {

        Manifest manifest = null;
        JarInputStream jin = null;

        try {
            jin = new JarInputStream(inStream);
            manifest = jin.getManifest();
            jin.close();
            jin = null;
        } finally {
            if (jin != null) {
                try {
                    jin.close();
                } catch (Throwable t) {
                    // Ignore
                }
            }
        }
View Full Code Here

TOP

Related Classes of java.util.jar.JarInputStream

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.