org.allcolor.yahp.converter
Class CJarLoaderURLHandler

java.lang.Object
  extended by java.net.URLStreamHandler
      extended by org.allcolor.yahp.converter.CJarLoaderURLHandler

public class CJarLoaderURLHandler
extends java.net.URLStreamHandler

Handler for jarfile URL

Version:
v0.94
Author:
Quentin Anciaux

Nested Class Summary
private  class CJarLoaderURLHandler.CGCCleaner
          This class will clean the preload map entry upon GC
 
Field Summary
private  java.net.URL file
          URL to the jar file
private  java.util.Map preload
          preload byte class map
 
Constructor Summary
CJarLoaderURLHandler(java.net.URL file)
          Creates a new CJarLoaderURLHandler object.
 
Method Summary
 void addClassPreload(java.lang.String path, byte[] array)
          add a class byte representation in the preload map
 java.net.URL getFile()
          Return the URL to the jar file
protected  java.net.URLConnection openConnection(java.net.URL u)
          Open a connection to the requested resource
 
Methods inherited from class java.net.URLStreamHandler
equals, getDefaultPort, getHostAddress, hashCode, hostsEqual, openConnection, parseURL, sameFile, setURL, setURL, toExternalForm
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

file

private final java.net.URL file
URL to the jar file


preload

private java.util.Map preload
preload byte class map

Constructor Detail

CJarLoaderURLHandler

public CJarLoaderURLHandler(java.net.URL file)
Creates a new CJarLoaderURLHandler object.

Parameters:
file - URL to a jar file
Method Detail

getFile

public java.net.URL getFile()
Return the URL to the jar file

Returns:
URL to the jar file

addClassPreload

public void addClassPreload(java.lang.String path,
                            byte[] array)
add a class byte representation in the preload map

Parameters:
path - path to the class inside the jar
array - byte representation

openConnection

protected java.net.URLConnection openConnection(java.net.URL u)
                                         throws java.io.IOException
Open a connection to the requested resource

Specified by:
openConnection in class java.net.URLStreamHandler
Parameters:
u - The url of the resource
Returns:
an URLConnection pointing to the resource
Throws:
java.io.IOException - If an error occured while accessing the resource