MineHacker API Docs/File class
The File class provides access to the files in the plugins/MineHacker directory. You can create a new file with one or two File or string path parameters (e.g. new File("MyFolder/myFile.txt")); if you provide two, the second is appended to the first.
Properties
name - The filename.
parent - The filepath of the parent directory, as a string.
Methods
read() - Reads the file into a Java byte array, and returns the array.
readText() - Reads the file as UTF-8 into a JavaScript string, and returns the string.
write(data) - Writes text or a Java byte array to a file. Text will be encoded as UTF-8.
writeText(text) - Writes text to a file. Text will be encoded as UTF-8.
isAbsolute() - Returns true if the File object was constructed with an absolute path, or false if it was a relative path.
getAbsolutePath() - Returns the absolute path to the file or directory denoted by this File object. The file or directory need not exist.
getRootRelativePath() - Returns the path relative to the server directory (the directory containing craftbukkit.jar).
exists() - Returns true if the file or directory exists, or false otherwise.
isDirectory() - Returns true if the File object represents an existant directory, or false otherwise.
isFile() - Returns true if the File object represents an existant file, or false otherwise.
lastModified() - Returns the modified date of the file. This number may be passed to the JavaScript Date constructor to get the date.
list() - Returns an array of the files names in the directory denoted by this File object. If the File is not a directory, returns an empty array.
listFiles() - Returns an array of the files in the directory denoted by this File object, as File objects. If the File is not a directory, returns an empty array.
deleteFile() - Deletes the file or empty directory denoted by this File object. If the File is a directory with something in it, an error is thrown.
deleteDirectory() - Deletes the file or directory denoted by this File object. If the File is a directory with something in it, the directory contents are deleted as well. Note that even if the File is a symbolic link, the contents will be wiped.
makeDir() - Creates the directory denoted by this File object. All neccessary parent directories will be created aswell.
move(destination) - Moves the file or directory to become the specified destination.
copy(destination) - Copies the file or directory to the specified destination.
equals(compare) - Compares the filepath represented by this File object to the one specified.
toString() - Returns the file path, relative to plugins/MineHacker
Comments