Package org.apache.commons.compress.archivers

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


            }catch (IOException e) {
                //not found
            }
        }
        if(is != null || new File(managedSolrDir,parsedResourceName).isDirectory()){
            ArchiveInputStream ais;
            try {
                ais = ManagementUtils.getArchiveInputStream(resourceName, is);
            } catch (ArchiveException e) {
                throw new IOException("Unable to open ArchiveInputStream for resource '"+
                    resourceName+"'!",e);
View Full Code Here


                if(metadata != null){ //may be removed in the meantime
                    String currentArchive = metadata.getArchive();
                    boolean inSync = metadata.isSynchronized();
                    if(resource.equals(currentArchive)){ //current archive may be null
                        currentArchive = null; //reset the current archive to null (none)
                        ArchiveInputStream ais = null;
                        for(String archive : metadata.getIndexArchives()){
                            if(!archive.equals(resource)) {
                                if(currentArchive == null){
                                    try {
                                        InputStream is = provider.getInputStream(null, archive, null);
View Full Code Here

        }
   
        @Override
        public boolean available(String resourceName, InputStream is) {
            log.info("IndexArchive {} available ...",resourceName);
            ArchiveInputStream ais;
            try {
                ais = ManagementUtils.getArchiveInputStream(resourceName, is);
            } catch (ArchiveException e) {
                log.error("Unable to open ArchiveInputStream for Resource '"+
                    resourceName+"'!",e);
View Full Code Here

                                     + indexPath + "\"");
                        }
                        server.updateIndex(indexName, indexPath, props);
                        setFinishedState(ResourceState.INSTALLED);
                    } else {
                        ArchiveInputStream ais = null;
                        try {
                            ais = ConfigUtils.getArchiveInputStream(archiveFormat, is);
                            server.updateIndex(indexName, ais);
                            // we are done ... set the state to installed!
                            setFinishedState(ResourceState.INSTALLED);
View Full Code Here

        } catch (IOException e) {
            logger.error("", e);
            throw new LDPathException(e);
        }

        ArchiveInputStream ret;
        try {
            ret = asf.createArchiveInputStream(new ByteArrayInputStream(out.toByteArray()));
        } catch (ArchiveException e) {
            String msg = "Cannot create a final tar archive while creating an ArchiveInputStream to create a Solr core";
            logger.error(msg, e);
View Full Code Here

        if (solrArchiveExtension == null || solrArchiveExtension.isEmpty()) {
            archiveFormat = solrArchiveName; // assume that the archiveExtension was parsed
        } else {
            archiveFormat = SUPPORTED_SOLR_ARCHIVE_FORMAT.get(solrArchiveExtension);
        }
        ArchiveInputStream ais;
        if ("zip".equals(archiveFormat)) {
            ais = new ZipArchiveInputStream(is);
        } else {
            if ("gz".equals(archiveFormat)) {
                is = new GZIPInputStream(is);
View Full Code Here

    protected void checkArchiveContent(File archive, List<String> expected)
            throws Exception {
        final InputStream is = new FileInputStream(archive);
        try {
            final BufferedInputStream buf = new BufferedInputStream(is);
            final ArchiveInputStream in = factory.createArchiveInputStream(buf);
            this.checkArchiveContent(in, expected);
        } finally {
            is.close();
        }
    }
View Full Code Here

    public void extract(File archive, File destination) throws IOException {
        assertExtractSource(archive);

        IOUtils.requireDirectory(destination);

        ArchiveInputStream input = null;
        try {
            input = createArchiveInputStream(archive);

            ArchiveEntry entry;
            while ((entry = input.getNextEntry()) != null) {
                File file = new File(destination, entry.getName());

                if (entry.isDirectory()) {
                    file.mkdirs();
                } else {
View Full Code Here

    public static List<String> doGet(File deb) throws IOException {
        ArReader arReader = new ArReader(deb);
        for (ReadableArFile readableArFile : arReader) {
            if ("control.tar.gz".equals(readableArFile.getName())) {

                ArchiveInputStream input = null;
                try {
                    input = new ArchiveStreamFactory()
                            .createArchiveInputStream(new BufferedInputStream(new GzipCompressorInputStream(readableArFile.open())));
                } catch (ArchiveException e) {
                    throw new IOException(e);
                }
                ArchiveEntry ae;
                while ((ae = input.getNextEntry()) != null) {
                    if (ae.getName().endsWith("control")) {
                        return IOUtils.readLines(input);
                    }
                }
            }
View Full Code Here

     *
     */
    public void run(final RatReport report) throws RatException {

        try {
            ArchiveInputStream input;

            /* I am really sad that classes aren't first-class objects in
               Java :'( */
            try {
                input = new TarArchiveInputStream(new GzipCompressorInputStream(new FileInputStream(file)));
            } catch (IOException e) {
                try {
                    input = new TarArchiveInputStream(new BZip2CompressorInputStream(new FileInputStream(file)));
                } catch (IOException e2) {
                    input = new ZipArchiveInputStream(new FileInputStream(file));
                }
            }

            ArchiveEntry entry = input.getNextEntry();
            while (entry != null) {
                File f = new File(entry.getName());
                byte[] contents = new byte[(int) entry.getSize()];
                int offset = 0;
                int length = contents.length;

                while (offset < entry.getSize()) {
                    int actualRead = input.read(contents, offset, length);
                    length -= actualRead;
                    offset += actualRead;
                }

                if (!entry.isDirectory() && !ignored(f)) {
                    report(report, contents, f);
                }

                entry = input.getNextEntry();
            }

            input.close();
        } catch (IOException e) {
            throw new RatException(e);
        }
    }
View Full Code Here

TOP

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

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.