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 newFolderAccessorfor the folder of the running jar file.FolderAccessor(String path) Creates a newFolderAccessorfor the folder with the given path. -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungbooleancontainsItem(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.voiddeleteFileSystemItem(String relativePath) Deletes the file system item with the given relative path from the folder of the currentFolderAccessorif it exists.getFileAccessors(String extension) getFileAccessorsRecursively(String extension) getFolderAccessor(String relativePath) voidOpens the folder of the currentFolderAccessorin 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 newFolderAccessorfor the folder of the running jar file. -
FolderAccessor
Creates a newFolderAccessorfor 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
FolderAccessorcontains 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
FileAccessorfor 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
FolderAccessorfor 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 currentFolderAccessorif it exists.- Parameter:
relativePath-
-
getFileAccessors
- Gibt zurück:
- new
FileAccessors for the files in the folder of the currentFolderAccessor.
-
getFileAccessors
- Parameter:
extension-- Gibt zurück:
- a new
FileAccessors for the files in the folder of the currentFolderAccessor, that have the given extension.
-
getFileAccessorsRecursively
- Parameter:
extension-- Gibt zurück:
- new
FileAccessorfor the files in the folder of the currentFolderAccessor, that have the given extension, recursively.
-
getFileAccessorsRecursively
- Gibt zurück:
- new
FileAccessorfor the files in the folder of the currentFolderAccessorrecursively.
-
getFileSystemItemAccessors
- Gibt zurück:
- new
FileSystemItemAccessorUnits to the file system items in the folder of the currentFolderAccessor.
-
getFolderAccessor
- Parameter:
relativePath-- Gibt zurück:
- a new
FolderAccessorfor the folder with the given relative path in the folder of the currentFolderAccessor.
-
openInFileExplorer
public void openInFileExplorer()Opens the folder of the currentFolderAccessorin 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.
-