Examples of ArchiveEntry


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

                                            true);
                ResourceWithFlags artifical =
                    new ResourceWithFlags(currentParent,
                                          dir, r.getCollectionFlags(),
                                          new ResourceFlags());
                ArchiveEntry ent = entryBuilder.buildEntry(artifical);
                out.putArchiveEntry(ent);
                out.closeArchiveEntry();
            }
        }
    }
View Full Code Here

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

                                     File dir)
        throws IOException {
        FileNameMapper mapper = getMapper();
        log("Expanding: " + name + " into " + dir, Project.MSG_INFO);
        boolean empty = true;
        ArchiveEntry ent = null;
        while ((ent = is.getNextEntry()) != null) {
            if (skipUnreadable && !is.canReadEntryData(ent)) {
                log(Messages.skippedIsUnreadable(ent));
                continue;
            }
            empty = false;
            log("extracting " + ent.getName(), Project.MSG_DEBUG);
            extractFile(FileUtils.getFileUtils(), null, dir, is,
                        ent.getName(), ent.getLastModifiedDate(),
                        ent.isDirectory(), mapper);
        }
        if (empty && getFailOnEmptyArchive()) {
            throw new BuildException("archive '" + name + "' is empty");
        }
        log("expand complete", Project.MSG_VERBOSE);
View Full Code Here

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

    public InputStream getInputStream() throws IOException {
        if (isReference()) {
            return ((Resource) getCheckedRef()).getInputStream();
        }
        final ArchiveInputStream i = getStream();
        ArchiveEntry ae = null;
        while ((ae = i.getNextEntry()) != null) {
            if (ae.getName().equals(getName())) {
                return i;
            }
        }

        FileUtils.close(i);
View Full Code Here

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

     */
    protected void fetchEntry() {
        ArchiveInputStream i = null;
        try {
            i = getStream();
            ArchiveEntry ae = null;
            while ((ae = i.getNextEntry()) != null) {
                if (ae.getName().equals(getName())) {
                    setEntry(ae);
                    return;
                }
            }
        } catch (IOException e) {
View Full Code Here

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

     * patterns and didn't match any exclude patterns.
     */
    protected void fillMapsFromArchive(Resource src, String encoding,
                                       Map fileEntries, Map matchFileEntries,
                                       Map dirEntries, Map matchDirEntries) {
        ArchiveEntry entry = null;
        ArchiveInputStream ai = null;

        try {
            try {
                ai = StreamHelper.getInputStream(factory, src, encoding);
                if (ai == null) {
                    ai =
                        factory.getArchiveStream(new BufferedInputStream(src
                                                                         .getInputStream()),
                                                 encoding);
                }
            } catch (IOException ex) {
                throw new BuildException("problem opening " + src, ex);
            }
            while ((entry = ai.getNextEntry()) != null) {
                if (skipUnreadable && !ai.canReadEntryData(entry)) {
                    log(Messages.skippedIsUnreadable(entry));
                    continue;
                }
                Resource r = builder.buildResource(src, encoding, entry);
                String name = entry.getName();
                if (entry.isDirectory()) {
                    name = trimSeparator(name);
                    dirEntries.put(name, r);
                    if (match(name)) {
                        matchDirEntries.put(name, r);
                    }
View Full Code Here

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

            Metadata metadata, ParseContext context)
            throws IOException, SAXException {
        XHTMLContentHandler xhtml = new XHTMLContentHandler(handler, metadata);
        xhtml.startDocument();

        ArchiveEntry entry = archive.getNextEntry();
        while (entry != null) {
            if (!entry.isDirectory()) {
                xhtml.startElement("div", "class", "package-entry");
                Metadata entrydata = new Metadata();
                String name = entry.getName();
                if (name != null && name.length() > 0) {
                    entrydata.set(Metadata.RESOURCE_NAME_KEY, name);
                    xhtml.element("h1", name);
                }
                try {
View Full Code Here

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

    }

    public void parse(InputStream stream, ContentHandler handler, Metadata metadata, ParseContext context)
            throws IOException, SAXException, TikaException {
        ArchiveInputStream zip = new ZipArchiveInputStream(stream);
        ArchiveEntry entry = zip.getNextEntry();
        Parser parser = context.get(Parser.class, EmptyParser.INSTANCE);
        while (entry != null) {
            if (!relevantFileNames.contains(entry.getName())) {
                entry = zip.getNextEntry();
                continue;
            }

            parser.parse(new CloseShieldInputStream(zip), handler, metadata, context);
View Full Code Here

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

     * @throws SAXException if a SAX error occurs
     */
    public void unpack(ArchiveInputStream archive, XHTMLContentHandler xhtml)
            throws IOException, SAXException {
        try {
            ArchiveEntry entry = archive.getNextEntry();
            while (entry != null) {
                if (!entry.isDirectory()) {
                    Metadata entrydata = new Metadata();
                    String name = entry.getName();
                    if (name != null && name.length() > 0) {
                        entrydata.set(Metadata.RESOURCE_NAME_KEY, name);
                    }

                    if (extractor.shouldParseEmbedded(entrydata)) {
View Full Code Here

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

        XHTMLContentHandler xhtml = new XHTMLContentHandler(handler, metadata);
        xhtml.startDocument();

        try {
            ArchiveEntry entry = ais.getNextEntry();
            while (entry != null) {
                if (!entry.isDirectory()) {
                    parseEntry(ais, entry, extractor, xhtml);
                }
                entry = ais.getNextEntry();
            }
        } finally {
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
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.