Package java.util.jar

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


        }
        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

  }

  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

                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

        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

    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

  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

    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

 
  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

  private void executeUnzip() throws Exception {
   
    File file = null;
    JarFile jar;
    Enumeration content;
    JarEntry entry;
    String classFile = "";
    String filename = "";
    long archiveDate;
    long hdDate;
    int extracted = 0;
    int processed = 0;
   
    // individuelle Manifest Sektionen
    ArrayList iSecName = new ArrayList();
    ArrayList iSecOrigin = new ArrayList();
    ArrayList iSecDate = new ArrayList();
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
    String jarDate;
    int index;
   
    // Verzeichnis der Archive einlesen
    file = new File( this.source );
   
    // alle zu durchsuchenden jar- und zip-Archive ermitteln
    String path = null;
    String[] list = null;
   
    if ( file.isDirectory() ) {
      path = this.source;
      list = this.archiveFilter(file.list());
    } else {
      path = file.getPath().substring(0,file.getPath().length()-file.getName().length());
      list = new String[1];
      list[0] = file.getName();
    }
   
    if ( list.length == 0 ) {
      this.logln("\n no jar/zip archives found");
      return;
    }
   
    if ( this.oldOverwrites )
      this.logln("\n directive: overwrite newer versions");
    else
      this.logln("\n directive: overwrite older versions");
   
    try {
     
      // alle Archive durchgehen
      for (int i=0; i<list.length; i++) {
       
        this.logln("\n unpack "+ list[i] +":");
       
        jar = new JarFile(path + list[i]);
        content = jar.entries();
       
        file = new File(path + list[i]);
        jarDate = ( file.lastModified() < 0 ) ? "unknown" : sdf.format(new Date(file.lastModified()))
       
        // alle Klassen eines Archivs durchgehen
        while ( content.hasMoreElements() ) {
         
          entry = (JarEntry)content.nextElement();
          classFile = entry.getName();
         
          if ( !(classFile.charAt(classFile.length()-1)=='/' || classFile.toUpperCase().equals("META-INF/MANIFEST.MF")) ) {
           
            index = classFile.lastIndexOf('/')+1; // behandelt R�ckgabewert -1 implizit mit
            // Dateiname muss vom regul�ren Ausdruck erfasst werden
            if ( this.fileFilterPattern.matcher(classFile.substring(index)).matches() ) {
             
              // Paketstruktur aufl�sen?
              if ( this.detach )
                filename = classFile.substring(index);
              else
                filename = classFile;
             
              file = new File( ((this.targetPath!=null) ? this.targetPath : "") + filename );
             
              // Datei existiert schon auf Platte
              if ( file.canRead() ) {
               
                hdDate = file.lastModified();
                archiveDate = entry.getTime();
               
                if ( (!this.oldOverwrites && (archiveDate > hdDate)) || (this.oldOverwrites && (archiveDate < hdDate)) ) {
                  this.unpackJarEntry(jar, entry, this.targetPath);
                 
                  // f�r Manifest individuelle Sektionen
View Full Code Here

TOP

Related Classes of java.util.jar.JarEntry

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.