fi.hut.tml.xsmiles
Class NetworkClassLoader.URLResourceReader

java.lang.Object
  extended byfi.hut.tml.xsmiles.NetworkClassLoader.URLResourceReader
Enclosing class:
NetworkClassLoader

public class NetworkClassLoader.URLResourceReader
extends java.lang.Object

This implementation of URL Resource Reader assumes 2 types of base urls. A base url that ends with / is considered a resource folder, whereas a resource that does not end with / is considered a zip/jar resource folder. If the resource folder happens is a zip/jar archive, the entries are always cached. For non-zip base urls, one could specify whether or not it should be cached.

Author:
Harish Prabandham

Constructor Summary
NetworkClassLoader.URLResourceReader(java.io.InputStream is)
          Creates a new URLResourceReader object with the given input stream.
NetworkClassLoader.URLResourceReader(java.net.URL baseurl)
          equivalent to URLResourceReader(baseurl, false)
NetworkClassLoader.URLResourceReader(java.net.URL baseurl, boolean cache)
          Creates a new URLResourceReader object.
 
Method Summary
 void close()
           
 byte[] getResource(java.lang.String resource)
          Returns an array of bytes read for this resource if the resource exists.
 java.util.Enumeration getResourceNames()
          Returns an Enumeration of all "known" resource names.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NetworkClassLoader.URLResourceReader

public NetworkClassLoader.URLResourceReader(java.net.URL baseurl,
                                            boolean cache)
                                     throws java.io.IOException
Creates a new URLResourceReader object. You can either give the URL of the zip/jar file or a base url where to look for additional resources. If the url ends with "/" then it is assumed to be a Base URL.


NetworkClassLoader.URLResourceReader

public NetworkClassLoader.URLResourceReader(java.net.URL baseurl)
                                     throws java.io.IOException
equivalent to URLResourceReader(baseurl, false)


NetworkClassLoader.URLResourceReader

public NetworkClassLoader.URLResourceReader(java.io.InputStream is)
                                     throws java.io.IOException
Creates a new URLResourceReader object with the given input stream. The stream is assumed to be a zip/jar stream.

Method Detail

getResourceNames

public java.util.Enumeration getResourceNames()
Returns an Enumeration of all "known" resource names.


getResource

public byte[] getResource(java.lang.String resource)
Returns an array of bytes read for this resource if the resource exists. This method blocks until the resource has been fully read. If the resource does not exist, this method returns null.


close

public void close()

toString

public java.lang.String toString()


X-Smiles 1.2