org.globus.cog.util
Class TextFileLoader

java.lang.Object
  extended byorg.globus.cog.util.TextFileLoader

public class TextFileLoader
extends Object

Loads a text file from a resource or file loadFromResource() tries to portably load from both if one fails


Constructor Summary
TextFileLoader()
           
 
Method Summary
 boolean exists(String resName)
           
 String loadFromFile(String fileName)
          Loads text from a file
 String loadFromResource(String resName)
          Reads text from a resource
 String loadFromStream(InputStream is)
          Reads text from an imput stream
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TextFileLoader

public TextFileLoader()
Method Detail

loadFromFile

public String loadFromFile(String fileName)
                    throws IOException
Loads text from a file

Parameters:
fileName - the file name to be loaded
Returns:
a String with the contents of the file
Throws:
IOException

loadFromStream

public String loadFromStream(InputStream is)
                      throws IOException
Reads text from an imput stream

Parameters:
is - the input stream to read the text from
Returns:
a String with the loaded text
Throws:
IOException

loadFromResource

public String loadFromResource(String resName)
Reads text from a resource

Parameters:
resName - the name of the resource
Returns:
a String with the loaded text

exists

public boolean exists(String resName)