GraphLab Project

graphlab.samples.ui.texteditor.myplugin.actions
Class ReadWriteTextFile

java.lang.Object
  extended by graphlab.samples.ui.texteditor.myplugin.actions.ReadWriteTextFile

public class ReadWriteTextFile
extends java.lang.Object


Constructor Summary
ReadWriteTextFile()
           
 
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 void setContents(java.io.File aFile, java.lang.String aContents)
          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
 

Constructor Detail

ReadWriteTextFile

public ReadWriteTextFile()
Method Detail

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.

setContents

public static void setContents(java.io.File aFile,
                               java.lang.String aContents)
                        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.

GraphLab Project