Package java.util.zip

Examples of java.util.zip.ZipEntry


  // -------------------------------------------------------------------------

  protected boolean doesElementExistInArchive( String elementName )
    throws Exception
  {
    ZipEntry entry ;

    entry = this.entryFromArchive( elementName ) ;
       
    return ( entry != null ) ;
  } // doesElementExistInArchive()
View Full Code Here


  // -------------------------------------------------------------------------

  protected boolean isFileInArchive( String elementName )
    throws Exception
  {
    ZipEntry entry ;
    entry = this.entryFromArchive( elementName ) ;
   
    // Unfortunately entry.isDirectory() returns false even for
    // pure directory entries inside a zip archive, so it can't be used here.
    // The trick below is problematic, because apart from
    // directories it will also not recognize files with size 0.
   
    return ( entry != null ) && ( entry.getSize() > 0 ) ;
  } // isFileInArchive()
View Full Code Here

  // -------------------------------------------------------------------------

  protected ZipEntry entryFromArchive( String elementName )
    throws Exception
  {
    ZipEntry entry ;
    ZipFile archive ;
    String name ;
   
    name = str().replaceAll( elementName, "\\", "/" ) ;
    archive = this.container() ;
    entry = archive.getEntry( name ) ;

    if (DEBUG)
    {
      // if ( entry == null ) com.mdcs.joi.Inspector.inspect( name ) ;
      System.out.print( archive.getName() + "::" + name + " --- "
                + ( entry != null ) ) ;
      if ( entry == null )
      {
        System.out.println() ;       
      }
      else
      {
        System.out.print( " (" + entry.getSize()  + ")" ) ;
        System.out.print( " (T:" + entry.getTime()  + ")" ) ;
        System.out.println( " (" + ( entry.isDirectory() ? "Dir" : "File" ) + ")" ) ;
      }
    }
   
    return entry ;
  } // entryFromArchive()
View Full Code Here

  protected File fileRef()
    throws Exception
  {
    InputStream archiveStream ;
    FileOutputStream fileStream ;
    ZipEntry entry ;
    File tempFile ;
   
    if ( this.isInArchive() )
    {
      entry = this.archiveEntry() ;
View Full Code Here

        zipFile = new ZipFile(file);
       
        entries = zipFile.entries();

        while(entries.hasMoreElements()) {
          ZipEntry entry = (ZipEntry)entries.nextElement();
          if(entry.isDirectory()) {
            (new File(targetDir, entry.getName())).mkdir();
            continue;
          }
          InputStream in = zipFile.getInputStream(entry);
          OutputStream out = new FileOutputStream(new File(targetDir, entry.getName()));   
          try {
            WGUtils.inToOut(in, out, 2048);
          } finally {
            out.close();
            in.close();
View Full Code Here

    File    update_file = null;
   
    try{
      zip = new ZipInputStream(data);

      ZipEntry entry = null;

      while((entry = zip.getNextEntry()) != null) {

        String name = entry.getName().trim();

        if ( name.equals( "azureus.sig" ) || name.endsWith( "/" ) || name.length() == 0 ){
         
          continue;
        }
View Full Code Here

           String chmod_command = findCommand( "chmod" );
          
          try{
          while( true ){
                       
            ZipEntry  entry = zis.getNextEntry();
             
            if ( entry == null ){
             
              break;
            }
           
            if ( entry.isDirectory()){
             
              continue;
            }
           
            String  name = entry.getName();
           
            FileOutputStream  entry_os   = null;
            File        entry_file   = null;
           
            if ( !name.endsWith("/")){
View Full Code Here

      OutputStream out = new FileOutputStream(tmpFile);
      if (out != null) {
        // Create a zip output on file 
        zipOut = new ZipOutputStream(out);
        // Write furniture description file in first entry
        zipOut.putNextEntry(new ZipEntry(DefaultFurnitureCatalog.PLUGIN_FURNITURE_CATALOG_FAMILY + ".properties"));
        writeFurnitureLibraryProperties(zipOut, furnitureLibrary, furnitureLibraryFile,
            offlineFurnitureLibrary, contentMatchingFurnitureName,
            furnitureResourcesRemoteAbsoluteUrlBase, furnitureResourcesRemoteRelativeUrlBase,
            contentEntries);
        zipOut.closeEntry();
        // Write supported languages description files
        for (String language : furnitureLibrary.getSupportedLanguages()) {
          if (!FurnitureLibrary.DEFAULT_LANGUAGE.equals(language)) {
            zipOut.putNextEntry(new ZipEntry(DefaultFurnitureCatalog.PLUGIN_FURNITURE_CATALOG_FAMILY + "_" + language + ".properties"));
            writeFurnitureLibraryLocalizedProperties(zipOut, furnitureLibrary, language);
            zipOut.closeEntry();
          }
        }       
        // Write Content objects in files
View Full Code Here

     
      UpdateInstaller installer = checker.createInstaller();

      zip = new ZipInputStream(data);

      ZipEntry entry = null;

      while ((entry = zip.getNextEntry()) != null) {

        String name = entry.getName();

        if (name.toLowerCase().startsWith("windows/")) {

          // win32 only files
View Full Code Here

                new BufferedInputStream( new FileInputStream( file ) ));
         
         
            while( properties == null ){
             
              ZipEntry  entry = zis.getNextEntry();
               
              if ( entry == null ){
               
                break;
              }
           
              String  zip_name = entry.getName().toLowerCase( MessageText.LOCALE_ENGLISH );
           
              // System.out.println( "zis1:" + zip_name );
             
              if ( zip_name.equals( "plugin.properties" ) || zip_name.endsWith( "/plugin.properties")){
               
                properties  = new Properties();
               
                properties.load( zis );
                               
              }else if ( zip_name.endsWith( ".jar" )){
               
                ZipInputStream  zis2 = new ZipInputStream( zis );
               
                while( properties == null ){
                 
                  ZipEntry  entry2 = zis2.getNextEntry();
                   
                  if ( entry2 == null ){
                   
                    break;
                  }
               
                  String  zip_name2 = entry2.getName().toLowerCase( MessageText.LOCALE_ENGLISH );
             
                  // System.out.println( "    zis2:" + zip_name2 );
                 
                  if ( zip_name2.equals( "plugin.properties" )){
                   
View Full Code Here

TOP

Related Classes of java.util.zip.ZipEntry

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.