Class FileSystemItemAccessor
java.lang.Object
ch.nolix.base.environment.filesystem.FileSystemItemAccessor
- Direct Known Subclasses:
FileAccessor, FolderAccessor
A file system item accessor can access a given file system item. A file
system item is a file or a folder.
- Author:
- Silvan Wyss
-
Method Summary
Modifier and TypeMethodDescriptionfinal Stringfinal StringgetName()final FolderAccessorfinal StringgetPath()longfinal booleanhasExtension(String extension) final booleanisFile()final booleanisFolder()final voidOpens the parent folder of the file system item of this file system item accessor in the file explorer.static FileSystemItemAccessor
-
Method Details
-
withPath
- Parameters:
path-- Returns:
- a new
FileSystemItemAccessorfor the file system item with the given path. - Throws:
RuntimeException- if there does not exist a file system item with the given path in the file system on the local machine.
-
getExtension
- Returns:
- the extension of the name of the file system item of the current
FileSystemItemAccessor.
-
getName
- Returns:
- the name of the file system item of the current
FileSystemItemAccessor.
-
getParentFolderAccessor
- Returns:
- a new folder accessor to the parent folder of the file system item of this file system item accessor.
-
getPath
- Returns:
- the path of the file system item of this file system item accessor.
-
hasExtension
- Parameters:
extension-- Returns:
- true if the file system item of the current
FileSystemItemAccessorhas the given extension, false otherwise.
-
getSizeInBytes
public long getSizeInBytes()- Returns:
- the size of the file system item of this file system item accessor in bytes.
-
isFile
public final boolean isFile()- Returns:
- true if the file system item is a file in the file system on the local machine, false otherwise.
-
isFolder
public final boolean isFolder()- Returns:
- true if this path is a folder in the file system on the local machine, false otherwise.
-
openParentFolder
public final void openParentFolder()Opens the parent folder of the file system item of this file system item accessor in the file explorer.
-