Package com.spotify.docker.client
Class CompressedDirectory.Visitor
- All Implemented Interfaces:
FileVisitor<Path>
- Enclosing class:
CompressedDirectory
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final com.google.common.collect.ImmutableList
<CompressedDirectory.DockerIgnorePathMatcher> private final Path
private final org.apache.commons.compress.archivers.tar.TarArchiveOutputStream
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
Visitor
(Path root, com.google.common.collect.ImmutableList<CompressedDirectory.DockerIgnorePathMatcher> ignoreMatchers, org.apache.commons.compress.archivers.tar.TarArchiveOutputStream tarStream) -
Method Summary
Modifier and TypeMethodDescriptionprivate static boolean
exclude
(com.google.common.collect.ImmutableList<CompressedDirectory.DockerIgnorePathMatcher> matchers, Path path) Checks if any of the givenCompressedDirectory.DockerIgnorePathMatcher
matches the givenpath
.private static int
getFileMode
(Path file) private static int
getModeFromPermissions
(boolean read, boolean write, boolean execute) private static int
getPosixFileMode
(Path file) private static boolean
preVisitDirectory
(Path dir, BasicFileAttributes attrs) visitFile
(Path file, BasicFileAttributes attrs) Methods inherited from class java.nio.file.SimpleFileVisitor
postVisitDirectory, visitFileFailed
-
Field Details
-
root
-
ignoreMatchers
private final com.google.common.collect.ImmutableList<CompressedDirectory.DockerIgnorePathMatcher> ignoreMatchers -
tarStream
private final org.apache.commons.compress.archivers.tar.TarArchiveOutputStream tarStream
-
-
Constructor Details
-
Visitor
private Visitor(Path root, com.google.common.collect.ImmutableList<CompressedDirectory.DockerIgnorePathMatcher> ignoreMatchers, org.apache.commons.compress.archivers.tar.TarArchiveOutputStream tarStream)
-
-
Method Details
-
preVisitDirectory
- Specified by:
preVisitDirectory
in interfaceFileVisitor<Path>
- Overrides:
preVisitDirectory
in classSimpleFileVisitor<Path>
- Throws:
IOException
-
visitFile
- Specified by:
visitFile
in interfaceFileVisitor<Path>
- Overrides:
visitFile
in classSimpleFileVisitor<Path>
- Throws:
IOException
-
exclude
private static boolean exclude(com.google.common.collect.ImmutableList<CompressedDirectory.DockerIgnorePathMatcher> matchers, Path path) Checks if any of the givenCompressedDirectory.DockerIgnorePathMatcher
matches the givenpath
.- Parameters:
matchers
- theCompressedDirectory.DockerIgnorePathMatcher
to usepath
- the path to match- Returns:
true
if the given path should be excluded,false
otherwise
-
getFileMode
- Throws:
IOException
-
isPosixComplantFs
private static boolean isPosixComplantFs() -
getPosixFileMode
- Throws:
IOException
-
getModeFromPermissions
private static int getModeFromPermissions(boolean read, boolean write, boolean execute)
-