Examples of JarEntry


Examples of java.util.jar.JarEntry

  protected URL findResource(String name) {
    if (this.extensionJars != null) {
      // Try to find if resource belongs to one of the extracted jars
      for (int i = 0; i < this.extensionJars.length; i++) {
        JarFile extensionJar = this.extensionJars [i];
        JarEntry jarEntry = extensionJar.getJarEntry(name);
        if (jarEntry != null) {
          try {
            return new URL("jar:file:" + extensionJar.getName() + ":" + jarEntry.getName());
          } catch (MalformedURLException ex) {
            // Forget that we could have found a resource
          }
        }
      }
View Full Code Here

Examples of java.util.jar.JarEntry

            if (path.length() > 4 && path.substring(path.length()-4).toLowerCase().equals(".jar"))
            {
                try
                {
                    JarFile jarFile = new JarFile(path);
                    JarEntry jarEntry = jarFile.getJarEntry(PLUGIN_CONFIG_RESOURCE);
                    if (jarEntry != null)
                    {
                        InputStream configStream = null;
                        try
                        {
                            configStream = jarFile.getInputStream(jarEntry);
                            configure(jarEntry.getName(), configStream);
                        }
                        finally
                        {
                            if (configStream != null)
                            {
View Full Code Here

Examples of java.util.jar.JarEntry

        }
        String fullClassName = getFullBytecodeName(classFile);
        if (fullClassName == null) {
            return null;
        }
        JarEntry jarEntry = jar.getJarEntry(fullClassName);
        if (jarEntry != null) {
            try {
                return jar.getInputStream(jarEntry);
            } catch (IOException e) {
                BytecodeOutlinePlugin.log(e, IStatus.ERROR);
View Full Code Here

Examples of java.util.jar.JarEntry

  }

  public ClassData load(String name)
  {
    String filename = name + ".class";
    JarEntry entry = _jar.getJarEntry(filename);
    if (entry != null) {
      InputStream input = null;
      try {
        input = _jar.getInputStream(entry);
        int length = (int)entry.getSize();
        int offset = 0;
        byte[] data = new byte[length];
        while(offset < length) {
          int read = input.read(data, offset, length - offset);
          if (read == -1) {
View Full Code Here

Examples of java.util.jar.JarEntry

                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);
                    }
                    if (name.startsWith(path) && name.endsWith(".class")){
                        classes.add(name);
View Full Code Here

Examples of java.util.jar.JarEntry

        LinkedList<byte[]> fileData = new LinkedList<byte[]>();
        int limit = Integer.parseInt(args[1]);
        try {
            long totalSize = 0;
            JarInputStream jar = new JarInputStream(new FileInputStream(args[0]));
            JarEntry entry = jar.getNextJarEntry();
            while (fileData.size() < limit && entry != null) {
                String name = entry.getName();
                if (name.endsWith(".class")) {
                    if (entry.getSize() != -1) {
                        int len = (int) entry.getSize();
                        byte[] data = new byte[len];
                        int l = jar.read(data);
                        assert l == len;
                        fileData.add(data);
                        totalSize += data.length;
View Full Code Here

Examples of java.util.jar.JarEntry

    try {
      /*
       * See if class declarations file exists
       */
      Enumeration e = jf.entries();
      JarEntry je = null;
      String classfile = null;
      for (; e.hasMoreElements();) {
        je = (JarEntry) e.nextElement();
        if (je.toString().indexOf(s_pluginclassfile) >= 0) {
          classfile = je.toString();
        }
      }
      ze = jf.getEntry(classfile);
    } catch (NullPointerException e) {
      LogBuffer.println("JarFile has no tv_plugins.cd" +jf.getName());
View Full Code Here

Examples of java.util.jar.JarEntry

  private ArrayList<String> getAllFiles() {
    final ArrayList<String> files = new ArrayList<String>(50);
    if(isJar) {
      final Enumeration<JarEntry> entries = JarFileObject.entries();
      while(entries.hasMoreElements()) {
        final JarEntry entry = entries.nextElement();
        final String entryname = entry.getName();
        if(entryname.startsWith(pathInJar) && entryname.charAt(entryname.length()-1)!='/') {
          files.add(entryname);
        }
      }
    } else {
View Full Code Here

Examples of java.util.jar.JarEntry

    try {
      Set<String> packageNames = new HashSet<String>();
      JarFile jarFile = new JarFile(file);
      Enumeration<JarEntry> entries = jarFile.entries();
      while (entries.hasMoreElements()) {
        JarEntry entry = entries.nextElement();
        String name = entry.getName();
        if (name.endsWith(".class")) {
          logger.debug("Considering package of entry '{}'", name);

          int lastIndexOfSlash = name.lastIndexOf('/');
          if (lastIndexOfSlash != -1) {
View Full Code Here

Examples of java.util.jar.JarEntry

 
  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();
          classFile = entry.getName();
          lDate = entry.getTime();
          size = entry.getSize();
         
          if ( classFile.length()>6 )
            if ( classFile.substring(classFile.length()-6).equals(".class") )
              if ( !inventory.containsKey(classFile) ) {
               
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.