io
Class FileHandler

java.lang.Object
  extended by io.FileHandler

public class FileHandler
extends java.lang.Object

A class for dealing with file operations. Files can be loaded into memory as a String or a DataInputStream.

Hints

Author:
Peter Hlavac

Constructor Summary
FileHandler()
           
 
Method Summary
static boolean fileExists(java.lang.String strResource)
          Returns true if a file exists
static java.lang.String fileGet(java.lang.String strResource)
          Returns a file represented as a string
static java.io.DataInputStream fileGetAsStream(java.lang.String strResource)
          Returns a file represented as a DataInputStream
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileHandler

public FileHandler()
Method Detail

fileGet

public static java.lang.String fileGet(java.lang.String strResource)
                                throws java.io.IOException
Returns a file represented as a string

Parameters:
strResource - the file to load
Returns:
the file converted to a string
Throws:
java.io.IOException - thrown if file can not be accessed

fileGetAsStream

public static java.io.DataInputStream fileGetAsStream(java.lang.String strResource)
                                               throws java.io.IOException
Returns a file represented as a DataInputStream

Parameters:
strResource - the file to load
Returns:
the file converted to a DataInputStream
Throws:
java.io.IOException - thrown if file can not be accessed

fileExists

public static boolean fileExists(java.lang.String strResource)
Returns true if a file exists

Parameters:
strResource - the file to check
Returns:
  • true if the file does exist
  • false if the file does NOT exist