net.groboclown.util.io.v1
Class FileInputStreamGenerator

java.lang.Object
  |
  +--net.groboclown.util.io.v1.FileInputStreamGenerator
All Implemented Interfaces:
IInputStreamGenerator

public class FileInputStreamGenerator
extends Object
implements IInputStreamGenerator

A type of class which can generate a new InputStream based on just a partial name. Useful if a resource is loaded from a specific location (classpath resource, file system, URL, etc), and it references other resources which must be loaded relative to it.


Field Summary
private  String orig
           
private  String root
           
 
Constructor Summary
FileInputStreamGenerator(String originalName)
          Accepts the name of the 1st file loaded.
 
Method Summary
 InputStream createInputStream(String relativeName)
           
 File getFile(String relativeName)
           
 String getFullName(String relativeName)
           
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

root

private String root

orig

private String orig
Constructor Detail

FileInputStreamGenerator

public FileInputStreamGenerator(String originalName)
                         throws IOException
Accepts the name of the 1st file loaded. All files generated from this generator will be relative to its location. If the name is a directory, then all relative names will be in this directory.
Method Detail

getFile

public File getFile(String relativeName)

getFullName

public String getFullName(String relativeName)
Specified by:
getFullName in interface IInputStreamGenerator

createInputStream

public InputStream createInputStream(String relativeName)
                              throws IOException
Specified by:
createInputStream in interface IInputStreamGenerator


Written under the LGPL