Package org.japprove.files
Class TextFile
java.lang.Object
java.io.File
org.japprove.files.TextFile
- All Implemented Interfaces:
java.io.Serializable,java.lang.Comparable<java.io.File>
public class TextFile
extends java.io.File
An extension of an
File that provides functionality to read and write data of TextFile.- See Also:
- Serialized Form
-
Field Summary
-
Constructor Summary
Constructors Constructor Description TextFile(java.lang.String path) -
Method Summary
Methods inherited from class java.io.File
canExecute, canRead, canWrite, compareTo, createNewFile, createTempFile, createTempFile, delete, deleteOnExit, equals, exists, getAbsoluteFile, getAbsolutePath, getCanonicalFile, getCanonicalPath, getFreeSpace, getName, getParent, getParentFile, getPath, getTotalSpace, getUsableSpace, hashCode, isAbsolute, isDirectory, isFile, isHidden, lastModified, length, list, list, listFiles, listFiles, listFiles, listRoots, mkdir, mkdirs, renameTo, setExecutable, setExecutable, setLastModified, setReadable, setReadable, setReadOnly, setWritable, setWritable, toPath, toString, toURI, toURL
-
Constructor Details
-
TextFile
public TextFile(java.lang.String path)
-
-
Method Details
-
writeData
public void writeData(java.lang.String data) throws java.io.FileNotFoundExceptionStores a String in theTextFile.- Parameters:
data- the String that should be stored- Throws:
java.io.FileNotFoundException- thrown if the file not exists
-
readData
public java.lang.String readData() throws java.io.IOExceptionReads the data of theTextFileline by line.- Returns:
- the content of the
TextFilein a list - Throws:
java.io.IOException- thrown if the file cannot be created
-
create
Checks if the File already exists and creates a new one if not.- Throws:
FileCreationFailedException- thrown if the file cannot be created
-