jjdh API

jjdh.java.resource
Class Loader<T>

java.lang.Object
  extended by jjdh.java.resource.Loader<T>
Type Parameters:
T - the Type of the Resource which should be decoded by this loader
Direct Known Subclasses:
ClassObjectLoader, MD2Loader

public abstract class Loader<T>
extends Object

Author:
Dennis Heidsiek, Jonas Jacobi

Field Summary
protected  ResourceProvider provider
           
protected  ResourceReference shortcut
           
 
Constructor Summary
Loader()
           
Loader(String shortcut)
           
 
Method Summary
protected abstract  T decode(InputStream in)
           
 T load(InputStream inputStream)
           
 T load(ResourceReference res)
          Loads a resource.
 T load(String regex)
          Loads and decode a resource.
 List<T> loadSeveral(String regex)
          Loads and decodes Several resources at once.
protected  ResourceReference resolve(String regex)
          Try to resolve a textual reference to a resource into a correct ResourceReference.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

provider

protected final ResourceProvider provider

shortcut

protected final ResourceReference shortcut
Constructor Detail

Loader

public Loader()

Loader

public Loader(String shortcut)
Method Detail

resolve

protected ResourceReference resolve(String regex)
Try to resolve a textual reference to a resource into a correct ResourceReference. This method also tests the textual reference with the shortcut as prefix.

Parameters:
regex - a reference to the resource
Returns:
the correct reference, null otherwise

loadSeveral

public List<T> loadSeveral(String regex)
Loads and decodes Several resources at once.

Parameters:
regex - a reference to a directory with resources
Returns:
the loaded resource

load

public T load(String regex)
Loads and decode a resource.

Parameters:
regex - a reference to the resource
Returns:
the loaded resource

load

public final T load(ResourceReference res)
Loads a resource.

Parameters:
res - a reference to the resource
Returns:
the loaded resource

load

public final T load(InputStream inputStream)

decode

protected abstract T decode(InputStream in)
                     throws Exception
Throws:
Exception

jjdh API

Copyright © 2006 Jonas Jacobi and Dennis Heidsiek. All Rights Reserved.