Package org.apache.commons.compress.archivers

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


        } catch (IOException e) {
            throw new PackageException(e);
        }

        final InputStream is = new FileInputStream(tar);
        final ArchiveInputStream in = new ArchiveStreamFactory().createArchiveInputStream("tar", is);

        for (TarArchiveEntry entry = (TarArchiveEntry) in.getNextEntry(); entry != null; entry = (TarArchiveEntry) in.getNextEntry()) {
            final File newFile = new File(output, entry.getName());

            if (entry.isDirectory()) {
View Full Code Here


    private File tar(File src, File checksum, Map<String, Integer> modeMappings) throws IOException, ArchiveException {
        final File output = new File(src.getParent(), src.getName() + ".tar");
        output.delete();

        final OutputStream out = new FileOutputStream(output);
        final ArchiveOutputStream os = new ArchiveStreamFactory().createArchiveOutputStream("tar", out);

        if (checksum == null) {
            tar(src, null, src, os, modeMappings);

        } else {
View Full Code Here

    private File ar(File folder, String name) throws IOException, ArchiveException {
        final File output = new File(folder.getParent(), name + ".deb");
        output.delete();

        final OutputStream out = new FileOutputStream(output);
        final ArchiveOutputStream os = new ArchiveStreamFactory().createArchiveOutputStream(ArchiveStreamFactory.AR, out);

        ar(new File(folder, "debian-binary"), os);
        ar(new File(folder, "control.tar.gz"), os);
        ar(new File(folder, "data.tar.gz"), os);
View Full Code Here

        }

        ArchiveInputStream archiveInputStream = null;

        try {
            archiveInputStream = new ArchiveStreamFactory().createArchiveInputStream(is);
        } catch (ArchiveException e) {
            throw new IOException("Unsupported archive format: " + archive, e);
        }

        EntryConverter converter = null;
View Full Code Here

            file = zipFile;
        }

        ArchiveInputStream in = null;
        try {
            in = new ArchiveStreamFactory().createArchiveInputStream(new BufferedInputStream(new FileInputStream(file)));
            final byte[] buff = new byte[1024];
            ArchiveEntry entry;
            while ((entry = in.getNextEntry()) != null) {
                final File extractTarget = new File(targetDir.getAbsolutePath(), entry.getName());
                if (entry.isDirectory()) {
View Full Code Here

    private static void unTar(File tarFile, File target) throws IOException {
        InputStream is = new FileInputStream(tarFile);
        ArchiveInputStream in;
        try {
            in = new ArchiveStreamFactory().createArchiveInputStream("tar", is);
        } catch (ArchiveException e) {
            IOException ioe = new IOException("Unarchving "+tarFile.getName());
            ioe.initCause(e);
            throw ioe;
        }
View Full Code Here

    private static void removeExtractedTarFiles(File root, File tarFile) throws IOException {
        InputStream is = new FileInputStream(tarFile);
        ArchiveInputStream in;
        try {
            in = new ArchiveStreamFactory().createArchiveInputStream("tar", is);
        } catch (ArchiveException e) {
            IOException ioe = new IOException("Removing "+tarFile.getName());
            ioe.initCause(e);
            throw ioe;
        }
View Full Code Here

TOP

Related Classes of org.apache.commons.compress.archivers.ArchiveStreamFactory

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.