public class FilesUtils extends Object
Modifier and Type | Field and Description |
---|---|
static com.google.common.base.Supplier<Path> |
DEPLOYED_BASE_PATH |
static String |
FILE_SCHEME |
static String |
LEMMINX_WORKDIR_KEY |
Modifier and Type | Method and Description |
---|---|
static String |
convertToWindowsPath(String pathString)
Ensures there is no slash before a drive letter, and forces use of '\'
|
static String |
encodePath(String path)
Replace spaces with "%20".
|
static String |
getCachePathSetting() |
static Path |
getDeployedPath(Path path)
Returns the deployed path from the given
path . |
static String |
getFilePathSlash(String text)
Returns the slash ("/" or "\") that is used by the given string.
|
static int |
getOffsetAfterScheme(String uri) |
static Path |
getPath(String uri)
Returns the IO Path from the given uri.
|
static boolean |
isIncludedInDeployedPath(Path resourceCachePath) |
static String |
normalizePath(String pathString)
Given a file path as a string, will normalize it and return the normalized
string if valid, or null if not.
|
static boolean |
pathEndsWithFile(String pathString) |
static String |
removeFileScheme(String fileURI)
Remove the file:// scheme from the given file URI.
|
static void |
resetDeployPath()
Public for test purposes
|
static void |
saveToFile(InputStream in,
Path outFile)
Save the given input stream
in in the give out file
outFile |
static void |
saveToFile(String content,
Path outFile)
Save the given String
content in the give out file
outFile |
static void |
setCachePathSetting(String cachePathSetting) |
public static final String FILE_SCHEME
public static final String LEMMINX_WORKDIR_KEY
public static com.google.common.base.Supplier<Path> DEPLOYED_BASE_PATH
public static String getCachePathSetting()
public static void setCachePathSetting(String cachePathSetting)
public static void resetDeployPath()
public static String normalizePath(String pathString)
public static Path getDeployedPath(Path path) throws IOException
path
.path
- the pathpath
.IOException
public static void saveToFile(InputStream in, Path outFile) throws IOException
in
in the give out file
outFile
in
- the input streamoutFile
- the output fileIOException
public static void saveToFile(String content, Path outFile) throws IOException
content
in the give out file
outFile
content
- the string contentoutFile
- the output fileIOException
public static int getOffsetAfterScheme(String uri)
public static String getFilePathSlash(String text)
text
- public static String convertToWindowsPath(String pathString)
pathString
- public static boolean pathEndsWithFile(String pathString)
public static boolean isIncludedInDeployedPath(Path resourceCachePath)
public static String removeFileScheme(String fileURI)
fileURI
- the file URI.public static Path getPath(String uri)
uri
- the URICopyright © 2021. All rights reserved.