public class StandardPathUtilitiesProvider extends Object implements PathUtilitiesProvider
| Modifier and Type | Field and Description |
|---|---|
static String |
DIAGNOSTIC_OUTPUT_DIRECTORY_MESSAGE_FORMAT
The format of the message printed on the console by
StandardPathUtilitiesProvider.archiveAndDelete(java.lang.String, java.lang.String) showing the
absolute path of the zip file created. |
static String |
DIAGNOSTIC_OUTPUT_DIRECTORY_MESSAGE_REGEXP
The regular expression for matching the message derived from
StandardPathUtilitiesProvider.DIAGNOSTIC_OUTPUT_DIRECTORY_MESSAGE_FORMAT. |
| Constructor and Description |
|---|
StandardPathUtilitiesProvider() |
| Modifier and Type | Method and Description |
|---|---|
String |
archiveAndDelete(String directory,
String zip)
Zips and deletes
directory if it exists. |
String |
createDirectories(String path) |
String |
createFile(String path) |
void |
deleteFile(String path) |
boolean |
exists(String path) |
String |
getAbsolutePath(String path) |
String |
getParent(String path) |
String |
getPath(String first,
String... more) |
boolean |
isDirectory(String path,
boolean followLinks) |
WritableByteChannel |
openFileChannel(String path,
OpenOption... options) |
InputStream |
openInputStream(String path) |
OutputStream |
openOutputStream(String path,
boolean append) |
String |
sanitizeFileName(String name)
Gets a value based on
name that can be passed to PathUtilitiesProvider.getPath(String, String...)
without causing an InvalidPathException. |
public static final String DIAGNOSTIC_OUTPUT_DIRECTORY_MESSAGE_FORMAT
StandardPathUtilitiesProvider.archiveAndDelete(java.lang.String, java.lang.String) showing the
absolute path of the zip file created. The %s placeholder is replaced with the
absolute path of the zip file.public static final String DIAGNOSTIC_OUTPUT_DIRECTORY_MESSAGE_REGEXP
StandardPathUtilitiesProvider.DIAGNOSTIC_OUTPUT_DIRECTORY_MESSAGE_FORMAT.
Keep in sync with the catch_files array in common.json.public String createDirectories(String path) throws IOException
createDirectories in interface PathUtilitiesProviderIOExceptionFiles.createDirectories(java.nio.file.Path, java.nio.file.attribute.FileAttribute<?>...)public String getPath(String first, String... more)
getPath in interface PathUtilitiesProviderPaths.get(String, String...)public String getAbsolutePath(String path)
getAbsolutePath in interface PathUtilitiesProviderFile.getAbsolutePath()public OutputStream openOutputStream(String path, boolean append) throws IOException
openOutputStream in interface PathUtilitiesProviderIOExceptionFileOutputStream.FileOutputStream(String, boolean)public InputStream openInputStream(String path) throws IOException
openInputStream in interface PathUtilitiesProviderIOExceptionFileInputStream.FileInputStream(String)public boolean exists(String path)
exists in interface PathUtilitiesProviderFile.exists()public String sanitizeFileName(String name)
PathUtilitiesProvidername that can be passed to PathUtilitiesProvider.getPath(String, String...)
without causing an InvalidPathException.sanitizeFileName in interface PathUtilitiesProvidername with all characters invalid for the current file system replaced by
'_'public String createFile(String path) throws IOException
createFile in interface PathUtilitiesProviderIOExceptionFiles.createFile(java.nio.file.Path, java.nio.file.attribute.FileAttribute<?>...)public boolean isDirectory(String path, boolean followLinks)
isDirectory in interface PathUtilitiesProviderFiles.isDirectory(java.nio.file.Path, java.nio.file.LinkOption...)public void deleteFile(String path) throws IOException
deleteFile in interface PathUtilitiesProviderIOExceptionFiles.delete(Path)public String getParent(String path)
getParent in interface PathUtilitiesProviderFile.getParent()public WritableByteChannel openFileChannel(String path, OpenOption... options) throws IOException
openFileChannel in interface PathUtilitiesProviderIOExceptionFileChannel.open(Path, OpenOption...)public String archiveAndDelete(String directory, String zip) throws IOException
PathUtilitiesProviderdirectory if it exists.archiveAndDelete in interface PathUtilitiesProviderzip - path of the zip file to createIOException - if something goes wrong