public class ServerFilePathTransformer
extends java.lang.Object
FsFile
path and server-local File
.Constructor and Description |
---|
ServerFilePathTransformer() |
Modifier and Type | Method and Description |
---|---|
FsFile |
getFsFileFromServerFile(java.io.File serverFile)
Given a server-local
File , returns the corresponding repository path. |
java.util.function.Function<java.lang.String,java.lang.String> |
getPathSanitizer()
Get the string transformer that is used to make file-path components safe across platforms.
|
java.io.File |
getServerFileFromFsFile(FsFile fsFile)
Given a repository path, returns the corresponding server-local
File . |
boolean |
isLegalFsFile(FsFile fsFile)
Test if the given
FsFile has been properly sanitized by the client. |
void |
setBaseDirFile(java.io.File baseDirFile)
Set the repository root directory, to which
FsFile instances are considered to be relative. |
void |
setPathSanitizer(java.util.function.Function<java.lang.String,java.lang.String> pathSanitizer)
Set the string transformer that is used to make file-path components safe across platforms.
|
public java.io.File getServerFileFromFsFile(FsFile fsFile)
File
.
Must be executed server-side.fsFile
- a repository pathFile
public FsFile getFsFileFromServerFile(java.io.File serverFile)
File
, returns the corresponding repository path.
Must be executed server-side.serverFile
- a server-local File
within the repositorypublic boolean isLegalFsFile(FsFile fsFile)
FsFile
has been properly sanitized by the client.fsFile
- a repository pathpublic java.util.function.Function<java.lang.String,java.lang.String> getPathSanitizer()
public void setPathSanitizer(java.util.function.Function<java.lang.String,java.lang.String> pathSanitizer)
pathSanitizer
- the file-path component string transformerpublic void setBaseDirFile(java.io.File baseDirFile)
FsFile
instances are considered to be relative.baseDirFile
- the repository root directoryjava.io.IOException
- if the absolute path of the root directory could not be foundjava.lang.IllegalArgumentException
- if the root directory does not exist