Package com.spotify.docker.client
Class CompressedDirectory.Visitor
- java.lang.Object
-
- java.nio.file.SimpleFileVisitor<java.nio.file.Path>
-
- com.spotify.docker.client.CompressedDirectory.Visitor
-
- All Implemented Interfaces:
java.nio.file.FileVisitor<java.nio.file.Path>
- Enclosing class:
- CompressedDirectory
private static class CompressedDirectory.Visitor extends java.nio.file.SimpleFileVisitor<java.nio.file.Path>
-
-
Field Summary
Fields Modifier and Type Field Description private com.google.common.collect.ImmutableList<CompressedDirectory.DockerIgnorePathMatcher>
ignoreMatchers
private java.nio.file.Path
root
private org.apache.commons.compress.archivers.tar.TarArchiveOutputStream
tarStream
-
Constructor Summary
Constructors Modifier Constructor Description private
Visitor(java.nio.file.Path root, com.google.common.collect.ImmutableList<CompressedDirectory.DockerIgnorePathMatcher> ignoreMatchers, org.apache.commons.compress.archivers.tar.TarArchiveOutputStream tarStream)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static boolean
exclude(com.google.common.collect.ImmutableList<CompressedDirectory.DockerIgnorePathMatcher> matchers, java.nio.file.Path path)
Checks if any of the givenCompressedDirectory.DockerIgnorePathMatcher
matches the givenpath
.private static int
getFileMode(java.nio.file.Path file)
private static int
getModeFromPermissions(boolean read, boolean write, boolean execute)
private static int
getPosixFileMode(java.nio.file.Path file)
private static boolean
isPosixComplantFs()
java.nio.file.FileVisitResult
preVisitDirectory(java.nio.file.Path dir, java.nio.file.attribute.BasicFileAttributes attrs)
java.nio.file.FileVisitResult
visitFile(java.nio.file.Path file, java.nio.file.attribute.BasicFileAttributes attrs)
-
-
-
Field Detail
-
root
private final java.nio.file.Path root
-
ignoreMatchers
private final com.google.common.collect.ImmutableList<CompressedDirectory.DockerIgnorePathMatcher> ignoreMatchers
-
tarStream
private final org.apache.commons.compress.archivers.tar.TarArchiveOutputStream tarStream
-
-
Constructor Detail
-
Visitor
private Visitor(java.nio.file.Path root, com.google.common.collect.ImmutableList<CompressedDirectory.DockerIgnorePathMatcher> ignoreMatchers, org.apache.commons.compress.archivers.tar.TarArchiveOutputStream tarStream)
-
-
Method Detail
-
preVisitDirectory
public java.nio.file.FileVisitResult preVisitDirectory(java.nio.file.Path dir, java.nio.file.attribute.BasicFileAttributes attrs) throws java.io.IOException
- Specified by:
preVisitDirectory
in interfacejava.nio.file.FileVisitor<java.nio.file.Path>
- Overrides:
preVisitDirectory
in classjava.nio.file.SimpleFileVisitor<java.nio.file.Path>
- Throws:
java.io.IOException
-
visitFile
public java.nio.file.FileVisitResult visitFile(java.nio.file.Path file, java.nio.file.attribute.BasicFileAttributes attrs) throws java.io.IOException
- Specified by:
visitFile
in interfacejava.nio.file.FileVisitor<java.nio.file.Path>
- Overrides:
visitFile
in classjava.nio.file.SimpleFileVisitor<java.nio.file.Path>
- Throws:
java.io.IOException
-
exclude
private static boolean exclude(com.google.common.collect.ImmutableList<CompressedDirectory.DockerIgnorePathMatcher> matchers, java.nio.file.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
private static int getFileMode(java.nio.file.Path file) throws java.io.IOException
- Throws:
java.io.IOException
-
isPosixComplantFs
private static boolean isPosixComplantFs()
-
getPosixFileMode
private static int getPosixFileMode(java.nio.file.Path file) throws java.io.IOException
- Throws:
java.io.IOException
-
getModeFromPermissions
private static int getModeFromPermissions(boolean read, boolean write, boolean execute)
-
-