Package org.codehaus.plexus.archiver

Examples of org.codehaus.plexus.archiver.ArchiveEntry


        GZipCompressor compressor = new GZipCompressor();
        if ( getFiles().size() > 1 )
        {
            throw new ArchiverException( "There is more than one file in input." );
        }
        ArchiveEntry entry = (ArchiveEntry) getFiles().values().toArray()[ 0 ];
        compressor.setSourceFile( entry.getFile() );
        compressor.setDestFile( getDestFile() );
        compressor.execute();
    }
View Full Code Here


      {
        return;
      }

      ResourceIterator iter = getResources();
      ArchiveEntry entry = iter.next();
      if ( iter.hasNext() )
      {
            throw new ArchiverException( "There is more than one file in input." );
        }
        compressor.setSource( entry.getResource() );
        compressor.setDestFile( getDestFile() );
        compressor.compress();
    }
View Full Code Here

        }

        longWarningGiven = false;
        while ( iter.hasNext() )
        {
            ArchiveEntry entry = iter.next();
            // Check if we don't add tar file in inself
            if ( ResourceUtils.isSame( entry.getResource(), tarFile ) )
            {
                throw new ArchiverException( "A tar file cannot include itself." );
            }
            String fileName = entry.getName();
            String name = StringUtils.replace( fileName, File.separatorChar, '/' );

            tarFile( entry, tOut, name );
        }
    }
View Full Code Here

      {
        return;
      }
     
      ResourceIterator iter = getResources();
      ArchiveEntry entry = iter.next();
        if ( iter.hasNext() )
        {
            throw new ArchiverException( "There is more than one file in input." );
        }
        compressor.setSource( entry.getResource() );
        compressor.setDestFile( getDestFile() );
        compressor.compress();
    }
View Full Code Here

    {
        File base = null;

        while ( resources.hasNext() )
        {
            ArchiveEntry entry = resources.next();
            String name = entry.getName();
            name = name.replace( File.separatorChar, '/' );
           
            if ( "".equals( name ) )
            {
                continue;
            }

            if ( entry.getResource().isDirectory() && !name.endsWith( "/" ) )
            {
                name = name + "/";
            }

            addParentDirs( base, name, zOut, "" );

            if ( entry.getResource().isFile() )
            {
                zipFile( entry, zOut, name );
            }
            else
            {
                zipDir( entry.getResource(), zOut, name, entry.getMode() );
            }
        }
    }
View Full Code Here

        try
        {
            while( iter.hasNext() )
            {
                ArchiveEntry f = iter.next();
                // Check if we don't add directory file in itself
                if ( ResourceUtils.isSame( f.getResource(), destDirectory ) )
                {
                    throw new ArchiverException( "The destination directory cannot include itself." );
                }
                String fileName = f.getName();
                String destDir = destDirectory.getCanonicalPath();
                fileName = destDir + File.separator + fileName;
                copyFile( f, fileName );
            }
        }
View Full Code Here

      /* Prepare a map of all paths to ISO objects and create all intermediate objects */
      directories.put("", root);

      for (ResourceIterator i = getResources(); i.hasNext();) {
        ArchiveEntry entry = i.next();

        switch (entry.getType()) {
        case ArchiveEntry.DIRECTORY: {
          ISO9660Directory dir;

          dir = new ISO9660Directory(getName(entry));

          directories.put(getPath(entry), dir);

          String path = getPath(entry);
          while ((path = getParentPath(path)) != "") {
            dir = new ISO9660Directory(getName(path));
            directories.put(path, dir);
          }

          break;
        }
        case ArchiveEntry.FILE: {
          ISO9660File file;
          ISO9660Directory dir;

          /* Create the file */
          file = new ISO9660File(
              new ArchiveEntryDataReference(entry),
              getName(entry), entry.getResource()
                  .getLastModified());

          files.put(getPath(entry), file);

          String path = getPath(entry);
View Full Code Here

        // Check if we don't add directory file in itself
        for ( Iterator iter = getFiles().keySet().iterator(); iter.hasNext(); )
        {
            String fileName = (String) iter.next();
            ArchiveEntry fileToAdd = (ArchiveEntry) getFiles().get( fileName );
            if ( destDirectory.equals( fileToAdd.getFile() ) )
            {
                throw new ArchiverException( "The destination directory cannot include itself." );
            }
        }

        getLogger().info( "Copying " + listFiles.size() + " files to " + destDirectory.getAbsolutePath() );

        try
        {
            for ( Iterator iter = getFiles().keySet().iterator(); iter.hasNext(); )
            {
                String fileName = (String) iter.next();
                ArchiveEntry f = (ArchiveEntry) getFiles().get( fileName );
                String destDir = destDirectory.getCanonicalPath();
                fileName = destDir + File.separator + fileName;
                copyFile( f, fileName );
            }
        }
View Full Code Here

        BZip2Compressor compressor = new BZip2Compressor();
        if ( getFiles().size() > 1 )
        {
            throw new ArchiverException( "There is more than one file in input." );
        }
        ArchiveEntry entry = (ArchiveEntry) getFiles().values().toArray()[ 0 ];
        compressor.setSourceFile( entry.getFile() );
        compressor.setDestFile( getDestFile() );
        compressor.execute();
    }
View Full Code Here

            for ( Iterator iter = archiveEntries.keySet().iterator(); iter.hasNext(); )
            {
                String fileName = (String) iter.next();
                String name = StringUtils.replace( fileName, File.separatorChar, '/' );

                ArchiveEntry entry = (ArchiveEntry) archiveEntries.get( fileName );

                tarFile( entry, tOut, name );
            }
        }
        catch ( IOException ioe )
View Full Code Here

TOP

Related Classes of org.codehaus.plexus.archiver.ArchiveEntry

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.