Examples of TarEntry


Examples of com.ice.tar.TarEntry

    TarInputStream tin = new TarInputStream( new GZIPInputStream(new FileInputStream(new File(tarFileName))));

    //get the first entry in the archive

    TarEntry tarEntry = tin.getNextEntry();

    while (tarEntry != null)
    { 
      //create a file with the same name as the tarEntry

      File destPath = new File(destination + File.separatorChar + tarEntry.getName());

      if (tarEntry.isDirectory())
      {
        destPath.mkdir();
      }
      else
      {
View Full Code Here

Examples of com.ice.tar.TarEntry

    FileInputStream fileStream = new FileInputStream( file );
    try {
      // create a zip input stream from the tmp file that was uploaded
      TarInputStream zipStream = new TarInputStream( new BufferedInputStream( fileStream ) );
      try {
        TarEntry entry = zipStream.getNextEntry();
        // iterate thru the entries in the zip file
        while ( entry != null ) {
          // ignore hidden directories and files, extract the rest
          if ( !entry.isDirectory() && !entry.getName().startsWith( "." ) && !entry.getName().startsWith( "__MACOSX/" ) ) { //$NON-NLS-1$ //$NON-NLS-2$
            File entryFile = null;
            if ( isTemporary() ) {
              String extension = ".tmp"; //$NON-NLS-1$
              int idx = entry.getName().lastIndexOf( '.' );
              if ( idx != -1 ) {
                extension = entry.getName().substring( idx ) + extension;
              }
              entryFile = PentahoSystem.getApplicationContext().createTempFile( session, "", extension, true ); //$NON-NLS-1$
            } else {
              entryFile = new File( getPath() + File.separatorChar + entry.getName() );
            }

            if ( sb.length() > 0 ) {
              sb.append( "\n" ); //$NON-NLS-1$
            }
View Full Code Here

Examples of com.ice.tar.TarEntry

    }
    protected void extractAndIndexTarFile(InputStream is, Document doc, TempFiles tempFiles, Charset charset ) {
      logger.debug("extractAndIndexTarFile()");
      try {
        TarInputStream gis = new TarInputStream(is);
        TarEntry entry;
        while((entry = gis.getNextEntry()) != null) {
                 String name = entry.getName();
                 int dot = name.lastIndexOf('.');
                 if (dot==-1) continue;
                 String extention = name.substring(dot+1,name.length());
                 Reader textReader = Extractor.getText(gis,extention,tempFiles,charset);
                   if (textReader!=null) {
View Full Code Here

Examples of org.apache.activemq.console.command.store.tar.TarEntry

    public void finish() throws IOException {
        stream.close();
    }

    private void store(String ext, Buffer value) throws IOException {
        TarEntry entry = new TarEntry(seq + "." + ext);
        seq += 1;
        entry.setSize(value.length());
        stream.putNextEntry(entry);
        value.writeTo(stream);
        stream.closeEntry();
    }
View Full Code Here

Examples of org.apache.commons.compress.archivers.tar.TarEntry

        // Build the index
        try
        {
            List strongRef = new ArrayList(100);
            TarEntry entry;
            while ((entry = getTarFile().getNextEntry()) != null)
            {
                FileName name = getFileSystemManager().resolveName(getRootName(), UriParser.encode(entry.getName()));

                // Create the file
                TarFileObject fileObj;
                if (entry.isDirectory() && getFileFromCache(name) != null)
                {
                    fileObj = (TarFileObject) getFileFromCache(name);
                    fileObj.setTarEntry(entry);
                    continue;
                }
View Full Code Here

Examples of org.apache.tika.parser.pkg.tar.TarEntry

        // At the end we want to close the tar stream to release any associated
        // resources, but the underlying document stream should not be closed
        TarInputStream tar =
            new TarInputStream(new CloseShieldInputStream(stream));
        try {
            TarEntry entry = tar.getNextEntry();
            while (entry != null) {
                if (!entry.isDirectory()) {
                    Metadata entrydata = new Metadata();
                    entrydata.set(Metadata.RESOURCE_NAME_KEY, entry.getName());
                    parseEntry(tar, xhtml, entrydata);
                }
                entry = tar.getNextEntry();
            }
        } finally {
View Full Code Here

Examples of org.apache.tools.tar.TarEntry

        this.spec = spec;
    }

    public void visitFile(FileVisitDetails fileDetails) {
        try {
            TarEntry archiveEntry = new TarEntry(fileDetails.getRelativePath().getPathString());
            archiveEntry.setModTime(fileDetails.getLastModified());
            archiveEntry.setSize(fileDetails.getSize());
            archiveEntry.setMode(UnixStat.FILE_FLAG | spec.getFileMode());
            tarOutStr.putNextEntry(archiveEntry);
            fileDetails.copyTo(tarOutStr);
            tarOutStr.closeEntry();
        } catch (Exception e) {
            throw new GradleException(String.format("Could not add %s to TAR '%s'.", fileDetails, tarFile), e);
View Full Code Here

Examples of org.apache.tools.tar.TarEntry

    }

    public void visitDir(FileVisitDetails dirDetails) {
        try {
            // Trailing slash on name indicates entry is a directory
            TarEntry archiveEntry = new TarEntry(dirDetails.getRelativePath().getPathString() + '/');
            archiveEntry.setModTime(dirDetails.getLastModified());
            archiveEntry.setMode(UnixStat.DIR_FLAG | spec.getDirMode());
            tarOutStr.putNextEntry(archiveEntry);
            tarOutStr.closeEntry();
        } catch (Exception e) {
            throw new GradleException(String.format("Could not add %s to TAR '%s'.", dirDetails, tarFile), e);
        }
View Full Code Here

Examples of org.apache.tools.tar.TarEntry

        AtomicBoolean stopFlag = new AtomicBoolean();
        try {
            FileInputStream inputStream = new FileInputStream(tarFile);
            try {
                NoCloseTarInputStream tar = new NoCloseTarInputStream(inputStream);
                TarEntry entry;
                while (!stopFlag.get() && (entry = tar.getNextEntry()) != null) {
                    if (entry.isDirectory()) {
                        visitor.visitDir(new DetailsImpl(entry, tar, stopFlag));
                    } else {
                        visitor.visitFile(new DetailsImpl(entry, tar, stopFlag));
                    }
View Full Code Here

Examples of org.apache.tools.tar.TarEntry

                source = new GZIPInputStream(source);
            } catch (IOException e) {
                throw new Parser.Failure("tar parser: " + e.getMessage(), url);
            }
        }
        TarEntry entry;
        final TarInputStream tis = new TarInputStream(source);                     
        File tmp = null;
       
        // loop through the elements in the tar file and parse every single file inside
        while (true) {
            try {
                if (tis.available() <= 0) break;
                entry = tis.getNextEntry();
                if (entry == null) break;
                if (entry.isDirectory() || entry.getSize() <= 0) continue;
                final String name = entry.getName();
                final int idx = name.lastIndexOf('.');
                final String mime = TextParser.mimeOf((idx > -1) ? name.substring(idx+1) : "");
                try {
                    tmp = FileUtils.createTempFile(this.getClass(), name);
                    FileUtils.copy(tis, tmp, entry.getSize());
                    subDocs = TextParser.parseSource(MultiProtocolURI.newURL(url,"#" + name), mime, null, tmp);
                    if (subDocs == null) continue;
                    for (final Document d: subDocs) docacc.add(d);
                } catch (final Parser.Failure e) {
                    log.logWarning("tar parser entry " + name + ": " + e.getMessage());
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.