public class FileHandlingFunctions extends Object
Note that these functions are NOT registered into the BASIC interpreter by default. The embedding application has to ask the interpreter to register the methods of this class if it wants BASIC programs access the file system.
Modifier and Type | Method and Description |
---|---|
static String |
absoluteFileName(String fileName) |
static void |
close(FileHandler fh) |
static void |
deleteFile(String fileName) |
static boolean |
fileCanExecute(String fileName) |
static boolean |
fileExists(String fileName) |
static boolean |
fileIsExecutable(String fileName) |
static boolean |
fileIsReadable(String fileName) |
static boolean |
fileIsWritable(String fileName) |
static Long |
fileLength(String fileName) |
static Long |
freeSpace(String fileName) |
static boolean |
isDirectory(String fileName) |
static boolean |
isFile(String fileName) |
static boolean |
isHidden(String fileName) |
static Long |
lastModified(String fileName) |
static BasicArrayValue |
listFiles(String fileName) |
static boolean |
mkdir(String fileName) |
static FileHandler |
open(String fileName,
String mode)
Opens a file and returns a file handler.
|
static String |
parentDirectory(String fileName) |
static void |
printf(FileHandler fh,
String line) |
static void |
printfln(FileHandler fh,
String line) |
static byte[] |
read(FileHandler fh,
int len) |
static String |
readLine(FileHandler fh) |
static boolean |
renameFile(String fileNameFrom,
String fileNameTo) |
static boolean |
setExecutable(String fileName,
boolean executable,
boolean ownerOnly) |
static boolean |
setLastModified(String fileName,
Long time) |
static boolean |
setReadable(String fileName,
boolean readable,
boolean ownerOnly) |
static boolean |
setRedOnly(String fileName) |
static boolean |
setWritable(String fileName,
boolean writable,
boolean ownerOnly) |
static void |
write(FileHandler fh,
byte[] buffer) |
public static FileHandler open(String fileName, String mode)
fileName
- the name of the file to be opened.mode
- the mode how to open the filepublic static String readLine(FileHandler fh) throws BasicRuntimeException, IOException
BasicRuntimeException
IOException
public static byte[] read(FileHandler fh, int len) throws BasicRuntimeException, IOException
BasicRuntimeException
IOException
public static void printf(FileHandler fh, String line) throws BasicRuntimeException, IOException
BasicRuntimeException
IOException
public static void printfln(FileHandler fh, String line) throws IOException, BasicRuntimeException
IOException
BasicRuntimeException
public static void write(FileHandler fh, byte[] buffer) throws BasicRuntimeException, IOException
BasicRuntimeException
IOException
public static void close(FileHandler fh) throws Exception
Exception
public static void deleteFile(String fileName)
public static boolean fileExists(String fileName)
public static boolean fileCanExecute(String fileName)
public static boolean fileIsReadable(String fileName)
public static boolean fileIsWritable(String fileName)
public static boolean fileIsExecutable(String fileName)
public static boolean isDirectory(String fileName)
public static boolean isFile(String fileName)
public static boolean isHidden(String fileName)
public static boolean mkdir(String fileName)
public static boolean setExecutable(String fileName, boolean executable, boolean ownerOnly)
public static boolean setReadable(String fileName, boolean readable, boolean ownerOnly)
public static boolean setWritable(String fileName, boolean writable, boolean ownerOnly)
public static boolean setRedOnly(String fileName)
public static BasicArrayValue listFiles(String fileName) throws ExecutionException
ExecutionException
Copyright © 2013 Verhas and Verhas Software Craftsmen. All Rights Reserved.