org.juniverse.utils
Class TextFile

java.lang.Object
  |
  +--java.io.File
        |
        +--org.juniverse.utils.TextFile
All Implemented Interfaces:
java.lang.Comparable, java.io.Serializable

public class TextFile
extends java.io.File

This class extends the class File.
usage:

    read from Ascii-File:
    TextFile t = new TextFile("bob.txt");
    String fileContent = t.getText();

    write to Ascii-File:
    TextFile t = new TextFile("bob.txt");
    t.setText("Hello drumedar!");

 

See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.io.File
pathSeparator, pathSeparatorChar, separator, separatorChar
 
Constructor Summary
TextFile(java.io.File filename)
           
TextFile(java.lang.String filename)
           
 
Method Summary
 java.lang.String getText()
          returns the content of the Ascii-File
 void setText(java.lang.String body)
          set the content of the Ascii-File
 
Methods inherited from class java.io.File
canRead, canWrite, compareTo, compareTo, createNewFile, createTempFile, createTempFile, delete, deleteOnExit, equals, exists, getAbsoluteFile, getAbsolutePath, getCanonicalFile, getCanonicalPath, getName, getParent, getParentFile, getPath, hashCode, isAbsolute, isDirectory, isFile, isHidden, lastModified, length, list, list, listFiles, listFiles, listFiles, listRoots, mkdir, mkdirs, renameTo, setLastModified, setReadOnly, toString, toURI, toURL
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TextFile

public TextFile(java.io.File filename)

TextFile

public TextFile(java.lang.String filename)
Method Detail

getText

public java.lang.String getText()
returns the content of the Ascii-File

Returns:
the content of the File as String

setText

public void setText(java.lang.String body)
set the content of the Ascii-File

Parameters:
body - new content of the File