Package org.apache.commons.compress.archivers

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


    LOG.info(String.format("Untaring %s to dir %s.", inputFile
        .getAbsolutePath(), outputDir.getAbsolutePath()));

    final List<File> untaredFiles = new LinkedList<File>();
    final InputStream is = new FileInputStream(inputFile);
    final TarArchiveInputStream debInputStream = (TarArchiveInputStream) new ArchiveStreamFactory()
        .createArchiveInputStream("tar", is);
    TarArchiveEntry entry = null;
    while ((entry = (TarArchiveEntry) debInputStream.getNextEntry()) != null) {
      final File outputFile = new File(outputDir, entry.getName());
      if (entry.isDirectory()) {
View Full Code Here


    LOG.info(String.format("Unzipping %s to dir %s.", inputFile
        .getAbsolutePath(), outputDir.getAbsolutePath()));

    final List<File> unzippedFiles = new LinkedList<File>();
    final InputStream is = new FileInputStream(inputFile);
    final ZipArchiveInputStream debInputStream = (ZipArchiveInputStream) new ArchiveStreamFactory()
        .createArchiveInputStream("zip", is);
    ZipArchiveEntry entry = null;
    while ((entry = (ZipArchiveEntry) debInputStream.getNextEntry()) != null) {
      final File outputFile = new File(outputDir, entry.getName());
      if (entry.isDirectory()) {
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

    StringBuilder classpath = new StringBuilder();
    // put the jar files under the archive in the classpath
    try {
      final InputStream is = new FileInputStream(archiveFile);
      final TarArchiveInputStream debInputStream =
          (TarArchiveInputStream) new ArchiveStreamFactory().createArchiveInputStream("tar", is);
      TarArchiveEntry entry = null;
      while ((entry = (TarArchiveEntry) debInputStream.getNextEntry()) != null) {
        if (entry.isFile()) {
          classpath.append(File.pathSeparatorChar);
          classpath.append("./" + serviceName + "/" + entry.getName());
View Full Code Here

        // Ensure that the stream supports the mark feature
        stream = new BufferedInputStream(stream);

        ArchiveInputStream ais;
        try {
            ArchiveStreamFactory factory = new ArchiveStreamFactory();
            ais = factory.createArchiveInputStream(stream);
        } catch (ArchiveException e) {
            throw new TikaException("Unable to unpack document stream", e);
        }

        MediaType type = getMediaType(ais);
View Full Code Here

        }
    }

    private static MediaType detectArchiveFormat(byte[] prefix, int length) {
        try {
            ArchiveStreamFactory factory = new ArchiveStreamFactory();
            ArchiveInputStream ais = factory.createArchiveInputStream(
                    new ByteArrayInputStream(prefix, 0, length));
            try {
                if ((ais instanceof TarArchiveInputStream)
                        && !TarArchiveInputStream.matches(prefix, length)) {
                    // ArchiveStreamFactory is too relaxed, see COMPRESS-117
View Full Code Here

   *
   * @param inStream InputStream
   * @return boolean
   */
  private static boolean isArchive(InputStream inStream) {
    ArchiveStreamFactory streamFactory = new ArchiveStreamFactory();
    try {
      streamFactory.createArchiveInputStream(inStream);
      return true;
    } catch (ArchiveException e) {
      logger.info("File is not an archive");
    }
    return false;
View Full Code Here

            if ( httpPort != null )
            {
                properties.put( Tomcat7Runner.HTTP_PORT_KEY, httpPort );
            }

            os = new ArchiveStreamFactory().createArchiveOutputStream( ArchiveStreamFactory.JAR,
                                                                       execWarJarOutputStream );

            if ( "war".equals( project.getPackaging() ) )
            {
View Full Code Here

        tmpWar.deleteOnExit();

        try
        {
            warOutputStream = new FileOutputStream( tmpWar );
            os = new ArchiveStreamFactory().createArchiveOutputStream( ArchiveStreamFactory.JAR, warOutputStream );
            os.putArchiveEntry( new JarArchiveEntry( "META-INF/context.xml" ) );
            IOUtils.copy( new FileInputStream( contextXmlFile ), os );
            os.closeArchiveEntry();

            JarFile jarFile = new JarFile( warFile );
View Full Code Here

            properties.put( Tomcat7Runner.ENABLE_NAMING_KEY, Boolean.toString( enableNaming ) );
            properties.put( Tomcat7Runner.ACCESS_LOG_VALVE_FORMAT_KEY, accessLogValveFormat );
            properties.put( Tomcat7Runner.HTTP_PROTOCOL_KEY, connectorHttpProtocol );
            properties.put( Tomcat7Runner.CODE_SOURCE_CONTEXT_PATH, path );

            os = new ArchiveStreamFactory().createArchiveOutputStream( ArchiveStreamFactory.JAR,
                                                                       execWarJarOutputStream );

            extractJarToArchive( new JarFile( projectArtifact.getFile() ), os, null );

            if ( serverXml != null && serverXml.exists() )
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.