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>ignoreMatchersprivate java.nio.file.Pathrootprivate org.apache.commons.compress.archivers.tar.TarArchiveOutputStreamtarStream
-
Constructor Summary
Constructors Modifier Constructor Description privateVisitor(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 booleanexclude(com.google.common.collect.ImmutableList<CompressedDirectory.DockerIgnorePathMatcher> matchers, java.nio.file.Path path)Checks if any of the givenCompressedDirectory.DockerIgnorePathMatchermatches the givenpath.private static intgetFileMode(java.nio.file.Path file)private static intgetModeFromPermissions(boolean read, boolean write, boolean execute)private static intgetPosixFileMode(java.nio.file.Path file)private static booleanisPosixComplantFs()java.nio.file.FileVisitResultpreVisitDirectory(java.nio.file.Path dir, java.nio.file.attribute.BasicFileAttributes attrs)java.nio.file.FileVisitResultvisitFile(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:
preVisitDirectoryin interfacejava.nio.file.FileVisitor<java.nio.file.Path>- Overrides:
preVisitDirectoryin 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:
visitFilein interfacejava.nio.file.FileVisitor<java.nio.file.Path>- Overrides:
visitFilein 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.DockerIgnorePathMatchermatches the givenpath.- Parameters:
matchers- theCompressedDirectory.DockerIgnorePathMatcherto usepath- the path to match- Returns:
trueif the given path should be excluded,falseotherwise
-
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)
-
-