Class SymLinkUtils
java.lang.Object
org.aksw.commons.io.util.SymLinkUtils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Collection<Path> allocateSymbolicLink(SymbolicLinkStrategy symlinkStrategy, Path rawTarget, Path rawSourceFolder, Function<String, String> fileNameNormalizer, String prefix, String suffix) Within 'folder' create a link to 'file' with name 'baseName' if it does not yet exist.static Collection<Path> allocateSymbolicLink(SymbolicLinkStrategy symlinkStrategy, Path rawTarget, Path rawSourceFolder, Function<String, String> fileNameNormalizer, String prefix, String suffix, ThrowingBiFunction<Path, Path, Path> tgtAndContentToFile) readSymbolicLinks(SymbolicLinkStrategy symlinkStrategy, Path sourceFolder, Function<String, String> filenameNormalizer, String prefix, String suffix) Within 'sourceFolder' read all symbolic links with the pattern 'baseName${number}' and return a map with their targets.static PathreadSymLinkAbsolute(Path symLink) Read a symbolic link and return and absolute path to its target.static PathresolveSymLinkAbsolute(Path symLinkSrc, Path symLinkTgt) Given a path that is considered a symlink and its target, return the absolute path obtained by resolving the target (which may be a relative path) against the symlink.streamSymbolicLinks(SymbolicLinkStrategy symlinkStrategy, Function<String, String> fileNameHarmonizer, String prefix, String suffix)
-
Constructor Details
-
SymLinkUtils
public SymLinkUtils()
-
-
Method Details
-
readSymLinkAbsolute
Read a symbolic link and return and absolute path to its target.- Parameters:
symLink-- Returns:
- Throws:
IOException
-
resolveSymLinkAbsolute
Given a path that is considered a symlink and its target, return the absolute path obtained by resolving the target (which may be a relative path) against the symlink. This method allows resolving a relative symlinkTgt of a different file system (e.g. UNIX) against a symLinkSrc (e.g. WebDAV)- Parameters:
symLinkSrc-symLinkTgt-- Returns:
-
allocateSymbolicLink
public static Collection<Path> allocateSymbolicLink(SymbolicLinkStrategy symlinkStrategy, Path rawTarget, Path rawSourceFolder, Function<String, String> fileNameNormalizer, String prefix, String suffix) throws ExceptionWithin 'folder' create a link to 'file' with name 'baseName' if it does not yet exist. Return the new link or all prior existing link(s)- Parameters:
file-folder-baseName-- Returns:
- Throws:
IOExceptionException
-
allocateSymbolicLink
-
streamSymbolicLinks
public static Function<Stream<Path>, Stream<com.google.common.collect.Table.Cell<String,Path, streamSymbolicLinksPath>>> (SymbolicLinkStrategy symlinkStrategy, Function<String, String> fileNameHarmonizer, String prefix, String suffix) throws IOException- Throws:
IOException
-
readSymbolicLinks
public static com.google.common.collect.Table<String,Path, readSymbolicLinksPath> (SymbolicLinkStrategy symlinkStrategy, Path sourceFolder, Function<String, String> filenameNormalizer, String prefix, String suffix) throws IOExceptionWithin 'sourceFolder' read all symbolic links with the pattern 'baseName${number}' and return a map with their targets.- Parameters:
rawSourceFolder-baseName-- Returns:
- Throws:
IOException
-