Klasse FileAccessor
java.lang.Object
ch.nolix.core.environment.filesystem.FileSystemItemAccessor
ch.nolix.core.environment.filesystem.FileAccessor
A file accessor can access a given file.
- Version:
- 2017-07-10
- Autor:
- Silvan Wyss
-
Konstruktorübersicht
KonstruktorBeschreibungFileAccessor
(String filePath) Creates a new file accessor for a file with the given file path. -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungvoid
Clears the file of this file accessor.void
overwriteFile
(byte[] bytes) Overwrites the file of this file accessor with the given bytes.void
overwriteFile
(String content) Overwrites the file of this file accessor with the given content.readFile()
Reads the content of the file of this file accessor.byte[]
Reads the content of the file of this file accessor to bytes.Reads the content of the file of this file accessor to lines.Von Klasse geerbte Methoden ch.nolix.core.environment.filesystem.FileSystemItemAccessor
getExtension, getInternalAccessor, getName, getParentFolderAccessor, getPath, getSizeInBytes, hasExtension, isFile, isFolder, openParentFolder
-
Konstruktordetails
-
FileAccessor
Creates a new file accessor for a file with the given file path.- Parameter:
filePath
-- Löst aus:
InvalidArgumentException
- if there does not exist a file with the given file path in the file system on the local machine.
-
-
Methodendetails
-
clearFile
public void clearFile()Clears the file of this file accessor. Deletes the content of the file of this file accessor, but not the file itself. -
overwriteFile
public void overwriteFile(byte[] bytes) Overwrites the file of this file accessor with the given bytes.- Parameter:
bytes
-- Löst aus:
RuntimeException
- if an error occurs.
-
overwriteFile
Overwrites the file of this file accessor with the given content.- Parameter:
content
-- Löst aus:
RuntimeException
- if an error occurs.
-
readFile
Reads the content of the file of this file accessor.- Gibt zurück:
- the content of the file of this file accessor.
- Löst aus:
RuntimeException
- if an error occurs.
-
readFileToBytes
public byte[] readFileToBytes()Reads the content of the file of this file accessor to bytes.- Gibt zurück:
- the bytes of the file of this file accessor.
- Löst aus:
RuntimeException
- if an error occurs.
-
readFileToLines
Reads the content of the file of this file accessor to lines.- Gibt zurück:
- the lines of the file of this file accessor.
- Löst aus:
RuntimeException
- if an error occurs.
-