Examples of ArchiveEntry


Examples of org.apache.commons.compress.archivers.ArchiveEntry

     * @throws IOException
     * @throws FileNotFoundException
     */
    private void addArchiveEntry(ArchiveOutputStream out, String filename, final File infile)
            throws IOException, FileNotFoundException {
        ArchiveEntry entry = out.createArchiveEntry(infile, filename);
        out.putArchiveEntry(entry);
        IOUtils.copy(new FileInputStream(infile), out);
        out.closeArchiveEntry();
        archiveList.add(filename);
    }
View Full Code Here

Examples of org.apache.commons.compress.archivers.ArchiveEntry

            throws Exception {
        File result = mkdir("dir-result");
        result.deleteOnExit();

        try {
            ArchiveEntry entry = null;
            while ((entry = in.getNextEntry()) != null) {
                File outfile = new File(result.getCanonicalPath() + "/result/"
                        + entry.getName());
                long copied=0;
                if (entry.isDirectory()){
                    outfile.mkdirs();
                } else {
                    outfile.getParentFile().mkdirs();
                    OutputStream out = new FileOutputStream(outfile);
                    try {
                        copied=IOUtils.copy(in, out);
                    } finally {
                        out.close();
                    }
                }
                final long size = entry.getSize();
                if (size != ArchiveEntry.SIZE_UNKNOWN) {
                    assertEquals("Entry.size should equal bytes read.",size, copied);
                }

                if (!outfile.exists()) {
                    fail("extraction failed: " + entry.getName());
                }
                if (expected != null && !expected.remove(getExpectedString(entry))) {
                    fail("unexpected entry: " + getExpectedString(entry));
                }
            }
View Full Code Here

Examples of org.apache.commons.compress.archivers.ArchiveEntry

        try {
            if (targetDir.exists()) {
                FileUtils.forceDelete(targetDir);
            }
            targetDir.mkdirs();
            ArchiveEntry entry = is.getNextEntry();
            while (entry != null) {
                String name = entry.getName();
                name = name.substring(name.indexOf("/") + 1);
                File file = new File(targetDir, name);
                if (entry.isDirectory()) {
                    file.mkdirs();
                } else {
                    file.getParentFile().mkdirs();
                    OutputStream os = new FileOutputStream(file);
                    try {
View Full Code Here

Examples of org.apache.commons.compress.archivers.ArchiveEntry

     * @throws IOException
     * @throws FileNotFoundException
     */
    private void addArchiveEntry(ArchiveOutputStream out, String filename, final File infile)
            throws IOException, FileNotFoundException {
        ArchiveEntry entry = out.createArchiveEntry(infile, filename);
        out.putArchiveEntry(entry);
        IOUtils.copy(new FileInputStream(infile), out);
        out.closeArchiveEntry();
        archiveList.add(filename);
    }
View Full Code Here

Examples of org.apache.commons.compress.archivers.ArchiveEntry

            throws Exception {
        File result = mkdir("dir-result");
        result.deleteOnExit();

        try {
            ArchiveEntry entry = null;
            while ((entry = in.getNextEntry()) != null) {
                File outfile = new File(result.getCanonicalPath() + "/result/"
                        + entry.getName());
                long copied=0;
                if (entry.isDirectory()){
                    outfile.mkdirs();
                } else {
                    outfile.getParentFile().mkdirs();
                    OutputStream out = new FileOutputStream(outfile);
                    try {
                        copied=IOUtils.copy(in, out);
                    } finally {
                        out.close();
                    }
                }
                final long size = entry.getSize();
                if (size != ArchiveEntry.SIZE_UNKNOWN) {
                    assertEquals("Entry.size should equal bytes read.",size, copied);
                }

                if (!outfile.exists()) {
                    fail("extraction failed: " + entry.getName());
                }
                if (expected != null && !expected.remove(getExpectedString(entry))) {
                    fail("unexpected entry: " + getExpectedString(entry));
                }
            }
View Full Code Here

Examples of org.apache.commons.compress.archivers.ArchiveEntry

            i += 2;
        }
    }

    public void testWriteAr() throws Exception {
        ArchiveEntry entry = new ArArchiveEntry("dummy", bytesToTest);
        compareWrites("ar", entry);
    }
View Full Code Here

Examples of org.apache.servicemix.jbi.framework.AutoDeploymentService.ArchiveEntry

     *
     * @jmx.managed-operation
     */
    public void installArchive(String archive) {
        try {
            ArchiveEntry entry = jbiContainer.getAutoDeploymentService().updateExternalArchive(archive, true);
            archiveMap.put(archive, entry);
        } catch (DeploymentException e) {
            throw new RuntimeException(
                    "ServiceMix JBIContainer unable to install archive ["
                    + archive + "]", e);
View Full Code Here

Examples of org.codehaus.plexus.archiver.ArchiveEntry

        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

Examples of org.codehaus.plexus.archiver.ArchiveEntry

            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

Examples of org.codehaus.plexus.archiver.ArchiveEntry

                String fileName = (String) iter.next();
                ZipEntry zipEntry;

                if ( ( zipEntry = zipFile.getEntry( fileName ) ) != null )
                {
                    ArchiveEntry currentEntry = (ArchiveEntry) getFiles().get( fileName );
                    if ( zipEntry.getTime() < currentEntry.getFile().lastModified() )
                    {
                        result.put( fileName, getFiles().get( fileName ) );
                    }
                }
            }
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.