Klasse FolderAccessor
java.lang.Object
ch.nolix.core.environment.filesystem.FileSystemItemAccessorUnit
ch.nolix.core.environment.filesystem.FolderAccessor
A
FolderAccessor
can access a folder.- Version:
- 2017-07-10
- Autor:
- Silvan Wyss
-
Konstruktorübersicht
KonstruktorenKonstruktorBeschreibungCreates a newFolderAccessor
for the folder of the running jar file.FolderAccessor
(String path) Creates a newFolderAccessor
for the folder with the given path. -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungboolean
containsItem
(String relativePath) createFile
(String relativePath) Creates a new empty file with the given relative path in the folder of the currentFolderAccessor
.createFolder
(String relativePath) Creates a new empty folder with the given relative path in the folder of the currentFolderAccessor
.void
deleteFileSystemItem
(String relativePath) Deletes the file system item with the given relative path from the folder of the currentFolderAccessor
if it exists.getFileAccessors
(String extension) getFileAccessorsRecursively
(String extension) getFolderAccessor
(String relativePath) void
Opens the folder of the currentFolderAccessor
in a new file explorer.Reads the content of the file with the given relative path.Von Klasse geerbte Methoden ch.nolix.core.environment.filesystem.FileSystemItemAccessorUnit
getExtension, getInternalAccessor, getName, getParentFolderAccessor, getPath, getSizeInBytes, hasExtension, isFile, isFolder, openParentFolder
-
Konstruktordetails
-
FolderAccessor
public FolderAccessor()Creates a newFolderAccessor
for the folder of the running jar file. -
FolderAccessor
Creates a newFolderAccessor
for the folder with the given path.- Parameter:
path
-- Löst aus:
InvalidArgumentException
- if there does not exist a folder with the given path in the file system on the local machine.
-
-
Methodendetails
-
containsItem
- Parameter:
relativePath
-- Gibt zurück:
- true if the folder of the current
FolderAccessor
contains an item with the given relative path.
-
createFile
Creates a new empty file with the given relative path in the folder of the currentFolderAccessor
.- Parameter:
relativePath
-- Gibt zurück:
- a new
FileAccessor
for the created file. - Löst aus:
InvalidArgumentException
- if there exists already a file system item with the given relative path in the folder of the currentFolderAccessor
.
-
createFolder
Creates a new empty folder with the given relative path in the folder of the currentFolderAccessor
.- Parameter:
relativePath
-- Gibt zurück:
- a new
FolderAccessor
for the created folder. - Löst aus:
InvalidArgumentException
- if there exists alreay a file system item with the given relative path in the folder of the currentFolderAccessor
.
-
deleteFileSystemItem
Deletes the file system item with the given relative path from the folder of the currentFolderAccessor
if it exists.- Parameter:
relativePath
-
-
getFileAccessors
- Gibt zurück:
- new
FileAccessor
s for the files in the folder of the currentFolderAccessor
.
-
getFileAccessors
- Parameter:
extension
-- Gibt zurück:
- a new
FileAccessor
s for the files in the folder of the currentFolderAccessor
, that have the given extension.
-
getFileAccessorsRecursively
- Parameter:
extension
-- Gibt zurück:
- new
FileAccessor
for the files in the folder of the currentFolderAccessor
, that have the given extension, recursively.
-
getFileAccessorsRecursively
- Gibt zurück:
- new
FileAccessor
for the files in the folder of the currentFolderAccessor
recursively.
-
getFileSystemItemAccessors
- Gibt zurück:
- new
FileSystemItemAccessorUnit
s to the file system items in the folder of the currentFolderAccessor
.
-
getFolderAccessor
- Parameter:
relativePath
-- Gibt zurück:
- a new
FolderAccessor
for the folder with the given relative path in the folder of the currentFolderAccessor
.
-
openInFileExplorer
public void openInFileExplorer()Opens the folder of the currentFolderAccessor
in a new file explorer. -
readFile
Reads the content of the file with the given relative path.- Parameter:
relativePath
-- Gibt zurück:
- the content of the file with the given relative path.
- Löst aus:
InvalidArgumentException
- if there does not exist a file with the given relative path in the folder of the currentFolderAccessor
.RuntimeException
- if an error occurs.
-