com.triangularpixels.rebirth.resources
Class FileIO

java.lang.Object
  extended by com.triangularpixels.rebirth.resources.FileIO
All Implemented Interfaces:
ResourceIO

public class FileIO
extends Object
implements ResourceIO

FileIO tries to open all resource requests first from the local file system (with an optional baseDir prefix). If a resource is not found in the local file system it then attempts to load it from the classpath. This means we can load files off disk (where they can be monitored for changes) during development but change to loading them from the classpath for actual distribution without requiring any code changes.

Author:
John Campbell

Constructor Summary
FileIO()
           
 
Method Summary
 boolean exists(String path)
           
 long getTimestamp(String filePath)
           
 long length(String path)
           
 Reader open(String path)
           
 InputStream openStream(String path)
           
 void setBaseDir(String baseDir)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileIO

public FileIO()
Method Detail

setBaseDir

public void setBaseDir(String baseDir)

exists

public boolean exists(String path)
Specified by:
exists in interface ResourceIO

length

public long length(String path)
Specified by:
length in interface ResourceIO

open

public Reader open(String path)
Specified by:
open in interface ResourceIO

openStream

public InputStream openStream(String path)
Specified by:
openStream in interface ResourceIO

getTimestamp

public long getTimestamp(String filePath)
Specified by:
getTimestamp in interface ResourceIO


Copyright © 2009 TriangularPixels.com. All Rights Reserved.