Package net.risingworld.api.utils
Klasse Utils.FileUtils
java.lang.Object
net.risingworld.api.utils.Utils.FileUtils
- Umschließende Klasse:
Utils
Contains various file function, including file access, reading or writing
to files, or getting the md5 checksum of a file.
-
Feldübersicht
-
Konstruktorübersicht
-
Methodenübersicht
Modifizierer und TypMethodeBeschreibungstatic String
Gets the MD5 hash of a file.static byte[]
readBytesFromFile
(File file) Reads the bytes of a file.static String
readStringFromFile
(File file) Reads a text / string from a file.static boolean
writeBytesToFile
(byte[] bytes, File file) Writes bytes to a file.static boolean
writeStringToFile
(String text, File file) Writes a string to file.
-
Felddetails
-
ROOT_DIR
-
-
Konstruktordetails
-
FileUtils
public FileUtils()
-
-
Methodendetails
-
writeStringToFile
Writes a string to file. This overrides the current file content.- Parameter:
text
- the text you want to write to a file.file
- the target file.- Gibt zurück:
- true if the text was written to the file successfully, false
if not.
- Example: Write String to txt file in the plugin directory
-
readStringFromFile
Reads a text / string from a file.- Parameter:
file
- the target file.- Gibt zurück:
- the string that was read from the file, or null if no such file was found.
-
writeBytesToFile
Writes bytes to a file. This overrides the current file content.- Parameter:
bytes
- the bytes you want to write to a file.file
- the target file.- Gibt zurück:
- true if the bytes were written to the file successfully, false if not.
-
readBytesFromFile
Reads the bytes of a file.- Parameter:
file
- the target file.- Gibt zurück:
- the file as a byte array.
-
getMd5
Gets the MD5 hash of a file.- Parameter:
file
- the target file.- Gibt zurück:
- the MD5 hash as a string, or null if no such file was found.
-