public class Files extends Object
| Constructor and Description |
|---|
Files() |
| Modifier and Type | Method and Description |
|---|---|
static void |
closeFile()
Closes any open files.
|
static void |
openFileForReading(String path)
Opens a file in READ mode.
|
static void |
openFileForWriting(String path,
boolean append)
Opens a file in WRITE mode.
|
static String |
readLine()
Reads a line of a READ-MODE file.
|
static void |
writeLine(String line)
Writes a line to a WRITE-MODE file.
|
public static void openFileForReading(String path)
readLine() will not work.path - The path of the file to read.public static void openFileForWriting(String path, boolean append)
writeLine(String) will not work.path - Path of the file to write.append - If we should append to the file. If true, new lines will be added. If false, the file will be replaced.public static void closeFile()
public static String readLine()
openFileForReading(String) or this will not work.public static void writeLine(String line)
openFileForWriting(String, boolean) or this will not work.line - What to write to the file.Copyright © 2021. All rights reserved.