Package org.apache.commons.compress.archivers

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


        getWebSocket().send(MessageBuilder.status().code(400).message("Could not get input stream from file ".concat(fileName)).build(), true);
        return;
      }
    }

    final ArchiveInputStream in = new ArchiveStreamFactory().createArchiveInputStream(new BufferedInputStream(is));
    ArchiveEntry entry          = in.getNextEntry();
    int overallCount            = 0;

    while (entry != null) {
View Full Code Here


    try {
      Files.deleteIfExists(warExecFile);
      Files.createDirectories(warExecFile.getParent());

      try (OutputStream os = Files.newOutputStream(warExecFile);
          ArchiveOutputStream aos = new ArchiveStreamFactory().createArchiveOutputStream(
              ArchiveStreamFactory.JAR, os)) {

        // If project is a war project add the war to the project
        if ("war".equalsIgnoreCase(project.getPackaging())) {
          File projectArtifact = project.getArtifact().getFile();
View Full Code Here

    String archive = (String) workItem.getParameter("Archive");
    List<File> files = (List<File>) workItem.getParameter("Files");
   
    try {
          OutputStream outputStream = new FileOutputStream( new File( archive) );         
          ArchiveOutputStream os = new ArchiveStreamFactory().createArchiveOutputStream("tar", outputStream);
         
      if (files != null) {
        for (File file: files) {
              final TarArchiveEntry entry = new TarArchiveEntry("testdata/test1.xml");
              entry.setModTime(0);
View Full Code Here

            ArchiveException {
        FileSystem fsout = FileSystem.get(dirPath.toUri(), getConf());
        String archiveType = "zip";
        FSDataOutputStream currentArchiveOS = fsout.create(new Path(dirPath,
                "part_" + String.format("%06d", partNum) + "." + archiveType));
        currentArchive = new ArchiveStreamFactory().createArchiveOutputStream(
                archiveType, currentArchiveOS);
        partNum++;
        numEntriesInCurrentArchive = 0;
    }
View Full Code Here

                    // TODO extend to other known types
                    if (unpack && URI.toLowerCase().endsWith(".zip")) {
                        FSDataInputStream fis = null;
                        try {
                            fis = fs.open(file);
                            ArchiveInputStream input = new ArchiveStreamFactory()
                                    .createArchiveInputStream(new BufferedInputStream(
                                            fis));
                            ArchiveEntry entry = null;
                            while ((entry = input.getNextEntry()) != null) {
                                String name = entry.getName();
View Full Code Here

            stream = new BufferedInputStream(stream);
        }

        ArchiveInputStream ais;
        try {
            ArchiveStreamFactory factory = context.get(
                    ArchiveStreamFactory.class, new ArchiveStreamFactory());
            ais = factory.createArchiveInputStream(stream);
        } catch (StreamingNotSupportedException sne) {
            // Most archive formats work on streams, but a few need files
            if (sne.getFormat().equals(ArchiveStreamFactory.SEVEN_Z)) {
                // Rework as a file, and wrap
                stream.reset();
View Full Code Here

        assertTrue(relIDs.allRelIDs.contains("test2.txt"));
    }

    @Test // TIKA-936
    public void testCustomEncoding() throws Exception {
        ArchiveStreamFactory factory = new ArchiveStreamFactory();
        factory.setEntryEncoding("SJIS");
        trackingContext.set(ArchiveStreamFactory.class, factory);

        InputStream stream = TikaInputStream.get(Base64.decodeBase64(
                "UEsDBBQAAAAIAI+CvUCDo3+zIgAAACgAAAAOAAAAk/qWe4zqg4GDgi50"
                + "eHRr2tj0qulsc2pzRHN609Gm7Y1OvFxNYLHJv6ZV97yCiQEAUEsBAh"
View Full Code Here

    public void testCount() throws Exception {
        File f = File.createTempFile("commons-compress-tarcount", ".tar");
        f.deleteOnExit();
        FileOutputStream fos = new FileOutputStream(f);

        ArchiveOutputStream tarOut = new ArchiveStreamFactory()
            .createArchiveOutputStream(ArchiveStreamFactory.TAR, fos);

        File file1 = getFile("test1.xml");
        TarArchiveEntry sEntry = new TarArchiveEntry(file1);
        tarOut.putArchiveEntry(sEntry);
View Full Code Here

        FileSystem fsout = FileSystem.get(dirPath.toUri(), getConf());
        String archiveType = "zip";
        partNum++;
        FSDataOutputStream currentArchiveOS = fsout.create(new Path(dirPath,
                "part_" + String.format("%06d", partNum) + "." + archiveType));
        currentArchive = new ArchiveStreamFactory().createArchiveOutputStream(
                archiveType, currentArchiveOS);
        numEntriesInCurrentArchive = 0;
    }
View Full Code Here

                                } else if (uri.endsWith(".tbz")
                                        || uri.endsWith(".tbz2")
                                        || uri.endsWith(".bzip2")) {
                                    fis = new BZip2CompressorInputStream(fis);
                                }
                                ArchiveInputStream input = new ArchiveStreamFactory()
                                        .createArchiveInputStream(new BufferedInputStream(
                                                fis));
                                ArchiveEntry entry = null;
                                while ((entry = input.getNextEntry()) != null) {
                                    String name = entry.getName();
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.