Package com.facebook.buck.util.unarchive
Class Unarchiver
- java.lang.Object
-
- com.facebook.buck.util.unarchive.Unarchiver
-
-
Constructor Summary
Constructors Constructor Description Unarchiver()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description com.google.common.collect.ImmutableList<Path>
extractArchive(ProjectFilesystemFactory projectFilesystemFactory, Path archiveFile, Path destination, ExistingFileMode existingFileMode)
Extract a given archive to a specific directorycom.google.common.collect.ImmutableList<Path>
extractArchive(ProjectFilesystemFactory projectFilesystemFactory, Path archiveFile, Path destination, Optional<Path> stripPrefix, PatternsMatcher entriesToExclude, ExistingFileMode existingFileMode)
Extract a given archive to a specific directorycom.google.common.collect.ImmutableSet<Path>
extractArchive(Path archiveFile, ProjectFilesystem filesystem, ExistingFileMode existingFileMode)
Extract a given archive to a destinationabstract com.google.common.collect.ImmutableSet<Path>
extractArchive(Path archiveFile, ProjectFilesystem filesystem, Path relativePath, Optional<Path> stripPrefix, PatternsMatcher entriesToExclude, ExistingFileMode existingFileMode)
Extract a given archive to a destinationcom.google.common.collect.ImmutableSet<Path>
extractArchive(Path archiveFile, ProjectFilesystem filesystem, Path relativePath, Optional<Path> stripPrefix, ExistingFileMode existingFileMode)
Extract a given archive to a destination
-
-
-
Method Detail
-
extractArchive
public com.google.common.collect.ImmutableSet<Path> extractArchive(Path archiveFile, ProjectFilesystem filesystem, Path relativePath, Optional<Path> stripPrefix, ExistingFileMode existingFileMode) throws IOException
Extract a given archive to a destination- Parameters:
archiveFile
- The path to the archivefilesystem
- The filesystem that will be extracted intorelativePath
- The path relative to the filesystem to extract files intostripPrefix
- If provided, only files under this prefix will be extracted. This prefix prefix will also be removed from the destination path. e.g. foo.tar.gz/foo/bar/baz with a prefix of foo will extract bar/baz into the destination directory. If not provided, no stripping is done.existingFileMode
- How to handle existing files- Returns:
- A list of paths to files that were created (not directories)
- Throws:
IOException
- If the archive could not be extracted for any reason
-
extractArchive
public abstract com.google.common.collect.ImmutableSet<Path> extractArchive(Path archiveFile, ProjectFilesystem filesystem, Path relativePath, Optional<Path> stripPrefix, PatternsMatcher entriesToExclude, ExistingFileMode existingFileMode) throws IOException
Extract a given archive to a destination- Parameters:
archiveFile
- The path to the archivefilesystem
- The filesystem that will be extracted intorelativePath
- The path relative to the filesystem to extract files intostripPrefix
- If provided, only files under this prefix will be extracted. This prefix prefix will also be removed from the destination path. e.g. foo.tar.gz/foo/bar/baz with a prefix of foo will extract bar/baz into the destination directory. If not provided, no stripping is done.entriesToExclude
- Entries that match this matcher will not be extractedexistingFileMode
- How to handle existing files- Returns:
- A list of paths to files that were created (not directories)
- Throws:
IOException
- If the archive could not be extracted for any reason
-
extractArchive
public com.google.common.collect.ImmutableSet<Path> extractArchive(Path archiveFile, ProjectFilesystem filesystem, ExistingFileMode existingFileMode) throws IOException
Extract a given archive to a destination- Parameters:
archiveFile
- The path to the archivefilesystem
- The filesystem that will be extracted intoexistingFileMode
- How to handle existing files- Returns:
- A list of paths to files that were created (not directories)
- Throws:
IOException
- If the archive could not be extracted for any reason
-
extractArchive
public com.google.common.collect.ImmutableList<Path> extractArchive(ProjectFilesystemFactory projectFilesystemFactory, Path archiveFile, Path destination, ExistingFileMode existingFileMode) throws IOException
Extract a given archive to a specific directory- Parameters:
projectFilesystemFactory
- A factory that creates filesystemsarchiveFile
- The path to the archivedestination
- The destination directory where the archive should be extracted toexistingFileMode
- How to handle existing files- Returns:
- A list of paths to files that were created (not directories)
- Throws:
InterruptedException
- If a filesystem could not be created in the destination directoryIOException
- If the archive could not be extracted for any reason
-
extractArchive
public com.google.common.collect.ImmutableList<Path> extractArchive(ProjectFilesystemFactory projectFilesystemFactory, Path archiveFile, Path destination, Optional<Path> stripPrefix, PatternsMatcher entriesToExclude, ExistingFileMode existingFileMode) throws IOException
Extract a given archive to a specific directory- Parameters:
projectFilesystemFactory
- A factory that creates filesystemsarchiveFile
- The path to the archivedestination
- The destination directory where the archive should be extracted tostripPrefix
- If provided, only files under this prefix will be extracted. This prefix prefix will also be removed from the destination path. e.g. foo.tar.gz/foo/bar/baz with a prefix of foo will extract bar/baz into the destination directory. If not provided, no stripping is done.existingFileMode
- How to handle existing files- Returns:
- A list of paths to files that were created (not directories)
- Throws:
IOException
- If the archive could not be extracted for any reason
-
-