it.imolinfo.jbi4corba.jbi.component
Class ReadWriteTextFile

java.lang.Object
  extended by it.imolinfo.jbi4corba.jbi.component.ReadWriteTextFile

public class ReadWriteTextFile
extends Object

Author:
graj

Constructor Summary
ReadWriteTextFile()
           
 
Method Summary
static String getContents(File aFile)
          Fetch the entire contents of a text file, and return it in a String.
static void main(String... aArguments)
          Simple test harness.
static void setContents(File aFile, 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 String getContents(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(File aFile,
                               String aContents)
                        throws FileNotFoundException,
                               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:
IllegalArgumentException - if param does not comply.
FileNotFoundException - if the file does not exist.
IOException - if problem encountered during write.

main

public static void main(String... aArguments)
                 throws IOException
Simple test harness.

Throws:
IOException


Copyright © 2005-2010 Imola Informatica. All Rights Reserved.