ontea.common
Class ReadWriteTextFile
java.lang.Object
ontea.common.ReadWriteTextFile
public class ReadWriteTextFile
- extends java.lang.Object
Method Summary |
static java.lang.String |
getContents(java.io.File aFile)
Fetch the entire contents of a text file, and return it in a String. |
static java.lang.String |
getContents(java.net.URL aURL)
Fetch the entire contents of a text file, and return it in a String. |
static void |
main(java.lang.String[] aArguments)
|
static void |
setContents(java.io.File aFile,
java.lang.String aContents)
|
static void |
setContents(java.io.File aFile,
java.lang.String aContents,
boolean create)
Change the contents of text file in its entirety, overwriting any
existing text. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ReadWriteTextFile
public ReadWriteTextFile()
getContents
public static java.lang.String getContents(java.io.File aFile)
- Fetch the entire contents of a text file, and return it in a String.
This style of implementation does not throw Exceptions to the caller.
- Parameters:
aFile
- is a file which already exists and can be read.
getContents
public static java.lang.String getContents(java.net.URL aURL)
- Fetch the entire contents of a text file, and return it in a String.
This style of implementation does not throw Exceptions to the caller.
- Parameters:
aURL
- is a URL which already exists and can be read.
setContents
public static void setContents(java.io.File aFile,
java.lang.String aContents)
throws java.io.FileNotFoundException,
java.io.IOException
- Throws:
java.io.FileNotFoundException
java.io.IOException
setContents
public static void setContents(java.io.File aFile,
java.lang.String aContents,
boolean create)
throws java.io.FileNotFoundException,
java.io.IOException
- Change the contents of text file in its entirety, overwriting any
existing text.
This style of implementation throws all exceptions to the caller.
- Parameters:
aFile
- is an existing file which can be written to.
- Throws:
java.lang.IllegalArgumentException
- if param does not comply.
java.io.FileNotFoundException
- if the file does not exist.
java.io.IOException
- if problem encountered during write.
main
public static void main(java.lang.String[] aArguments)
throws java.io.IOException
- Throws:
java.io.IOException