public class ClientFilePathTransformer
extends java.lang.Object
File
to repository FsFile
path. Wholly thread-safe.Constructor and Description |
---|
ClientFilePathTransformer(java.util.function.Function<java.lang.String,java.lang.String> pathSanitizer)
Construct a new client-side file path transformer.
|
Modifier and Type | Method and Description |
---|---|
FsFile |
getFsFileFromClientFile(java.io.File clientFile,
int depth)
Given a client-local
File , and a path component depth,
returns the corresponding repository path. |
int |
getMinimumDepth(java.util.Collection<java.io.File> files)
Get the smallest path component depth that allows the given set of
File s
to be disambiguated. |
java.util.Set<java.util.Collection<java.io.File>> |
getTooSimilarFiles(java.util.Set<java.io.File> files)
Get the files that are too similarly named.
|
public ClientFilePathTransformer(java.util.function.Function<java.lang.String,java.lang.String> pathSanitizer)
pathSanitizer
- a file-path component string transformer
whose behavior corresponds to that passed to ServerFilePathTransformer.setPathSanitizer(java.util.function.Function<java.lang.String, java.lang.String>)
server-side.public FsFile getFsFileFromClientFile(java.io.File clientFile, int depth) throws java.io.IOException
File
, and a path component depth,
returns the corresponding repository path. Must be executed client-side.clientFile
- a client-local File
depth
- the path component depth (including filename)java.io.IOException
- if the absolute path of the File
could not be foundpublic int getMinimumDepth(java.util.Collection<java.io.File> files) throws java.io.IOException
File
s
to be disambiguated. Must be executed client-side.files
- a set of File
sFile
s, no less than 1java.io.IOException
- if the absolute path of any of the File
s could not be foundpublic java.util.Set<java.util.Collection<java.io.File>> getTooSimilarFiles(java.util.Set<java.io.File> files) throws java.io.IOException
files
- a set of filesnull
if all the files are named sufficiently distinctlyjava.io.IOException
- if the absolute path of any of the File
s could not be found