Package java.util.jar

Examples of java.util.jar.JarFile


     */
    public static String[] getClassNamesForJarFile(String jarFileName)
    {
        try
        {
            JarFile jar = new JarFile(jarFileName);
            return getClassNamesForJarFile(jar);
        }
        catch (IOException ioe)
        {
            JPOXLogger.GENERAL.warn("Error opening the jar file " + jarFileName + " : " + ioe.getMessage());
View Full Code Here


    public static String[] getClassNamesForJarFile(URL jarFileURL)
    {
        File jarFile = new File(jarFileURL.getFile()); // TODO Check for errors
        try
        {
            JarFile jar = new JarFile(jarFile);
            return getClassNamesForJarFile(jar);
        }
        catch (IOException ioe)
        {
            JPOXLogger.GENERAL.warn("Error opening the jar file " + jarFileURL.getFile() + " : " + ioe.getMessage());
View Full Code Here

     */
    public static String[] getPackageJdoFilesForJarFile(String jarFileName)
    {
        try
        {
            JarFile jar = new JarFile(jarFileName);
            return getFileNamesWithSuffixForJarFile(jar, "package.jdo");
        }
        catch (IOException ioe)
        {
            JPOXLogger.GENERAL.warn("Error opening the jar file " + jarFileName + " : " + ioe.getMessage());
View Full Code Here

    public static String[] getPackageJdoFilesForJarFile(URL jarFileURL)
    {
        File jarFile = new File(jarFileURL.getFile()); // TODO Check for errors
        try
        {
            JarFile jar = new JarFile(jarFile);
            return getFileNamesWithSuffixForJarFile(jar, "package.jdo");
        }
        catch (IOException ioe)
        {
            JPOXLogger.GENERAL.warn("Error opening the jar file " + jarFileURL.getFile() + " : " + ioe.getMessage());
View Full Code Here

                    {
                        // remove "file:" from path, so we can use in File constructor
                        jarPath = jarPath.substring(5);
                    }
                    File jarFile = new File(jarPath);               
                    mf = new JarFile(jarFile).getManifest();
                    if (mf == null)
                    {
                        return null;
                    }
                    return registerBundle(mf, jarFile.toURI().toURL());
                }
            }           
            else if (manifest.getProtocol().equals("rar") || manifest.getProtocol().equals("war"))
            {
                // protocol formats:
                //     rar:<rar-path>!<jar-path>!<manifest-file>, war:<war-path>!<jar-path>!<manifest-file>
                String path = StringUtils.getDecodedStringFromURLString(manifest.toExternalForm());
                int index = path.indexOf(JAR_SEPARATOR);
                String rarPath = path.substring(4, index);
                File file = new File(rarPath);
                URL rarUrl = file.toURI().toURL();
               
                String jarPath = path.substring(index+1, path.indexOf(JAR_SEPARATOR,index+1));
                JarFile rarFile = new JarFile(file);
                mf = new JarInputStream(rarFile.getInputStream(rarFile.getEntry(jarPath))).getManifest();
                if (mf == null)
                {
                    return null;
                }
                return registerBundle(mf, rarUrl);
View Full Code Here

  private JarFile _jar;

  public JarLoader(File path) throws IOException
  {
    _jar = new JarFile(path);
  }
View Full Code Here

            }
            else if (protocol.equalsIgnoreCase("jar") ||
                protocol.equalsIgnoreCase("zip") ||
                protocol.equalsIgnoreCase("wsjar")){
             
                JarFile jar = ((JarURLConnection)url.openConnection()).getJarFile();
                Enumeration<JarEntry> entries = jar.entries();
                while(entries.hasMoreElements()){
                    JarEntry entry = entries.nextElement();
                    String name = entry.getName();
                    if (name.startsWith("/")){
                        name = name.substring(1);
View Full Code Here

    public boolean loadPlugin(URL jarURL) {
      boolean b_loadedPlugin = false;
      try {
        LogBuffer.println("Plugin Jar " + jarURL);
        JarURLConnection conn = (JarURLConnection)jarURL.openConnection();
        JarFile jarFile = conn.getJarFile();
        ArrayList al_classnames = getClassDeclarations(jarFile);
        for (int j = 0; j < al_classnames.size(); j++) {
          Class thisClass = getClass();
          URLClassLoader urlcl = new URLClassLoader(
              new URL[] { jarURL }, thisClass.getClassLoader());
View Full Code Here

 
  public ListDirs(final String uri) throws IOException, URISyntaxException {
    this.uri = uri;
    if(uri.startsWith("jar:")) {
      isJar = true;
      JarFileObject = new JarFile(uri.substring(9, uri.indexOf('!')));
      pathInJar = uri.substring(uri.indexOf('!') + 2);
    } else {
      FileObject = new File(new URI(uri));
    }
  }
View Full Code Here

    return fList;
  }
 
  private void executeCheck() throws Exception {
   
    JarFile jar;
    Enumeration content;
    JarEntry entry;
    String classFile;
    long lDate;
    long size;
   
    StringTokenizer st;
    SimpleDateFormat sdf;
    String firstFile;
    String firstDate;
    String firstSize;
    int gap;
    int duplicates = 0;
   
    File file = new File(this.source);
   
    // alle zu durchsuchenden jar- und zip-Archive ermitteln
    String[] list = this.archiveFilter(file.list());
   
    if ( list.length == 0 ) {
      this.logln("\n no jar/zip archives found");
      return;
    }
   
    Hashtable inventory = new Hashtable();
   
    try {
     
      int i = 0;
      // alle Archive durchgehen
      for (i=0; i<list.length; i++) {
       
        jar = new JarFile(this.source + list[i]);
       
        content = jar.entries();
       
        // alle Klassen eines Archivs durchgehen
        while ( content.hasMoreElements() ) {
         
          entry = (JarEntry)content.nextElement();
View Full Code Here

TOP

Related Classes of java.util.jar.JarFile

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.