org.codehaus.classworlds.uberjar.protocol.jar
Class JarUrlConnection

java.lang.Object
  extended by java.net.URLConnection
      extended by java.net.JarURLConnection
          extended by org.codehaus.classworlds.uberjar.protocol.jar.JarUrlConnection

public class JarUrlConnection
extends JarURLConnection

URLConnection capable of handling multiply-nested jars.

Version:
$Id: JarUrlConnection.java 78 2004-07-01 13:59:13Z jvanzyl $
Author:
bob mcwhirter

Field Summary
 
Fields inherited from class java.net.JarURLConnection
jarFileURLConnection
 
Fields inherited from class java.net.URLConnection
allowUserInteraction, connected, doInput, doOutput, ifModifiedSince, url, useCaches
 
Method Summary
 void connect()
           
protected  URL getBaseResource()
          Retrieve the base resource URL.
 InputStream getInputStream()
           
 JarFile getJarFile()
           
protected  InputStream getSegmentInputStream(InputStream baseIn, String segment)
          Retrieve the InputStream for the nesting segment relative to a base InputStream.
protected  String[] getSegments()
          Retrieve the nesting path segments.
protected static URL normaliseURL(URL url)
           
protected  void setupBaseResourceInputStream()
          Setup the InputStream purely from the base resource.
protected  void setupPathedInputStream()
          Setup the InputStream for URL with nested segments.
 
Methods inherited from class java.net.JarURLConnection
getAttributes, getCertificates, getEntryName, getJarEntry, getJarFileURL, getMainAttributes, getManifest
 
Methods inherited from class java.net.URLConnection
addRequestProperty, getAllowUserInteraction, getConnectTimeout, getContent, getContent, getContentEncoding, getContentLength, getContentType, getDate, getDefaultAllowUserInteraction, getDefaultRequestProperty, getDefaultUseCaches, getDoInput, getDoOutput, getExpiration, getFileNameMap, getHeaderField, getHeaderField, getHeaderFieldDate, getHeaderFieldInt, getHeaderFieldKey, getHeaderFields, getIfModifiedSince, getLastModified, getOutputStream, getPermission, getReadTimeout, getRequestProperties, getRequestProperty, getURL, getUseCaches, guessContentTypeFromName, guessContentTypeFromStream, setAllowUserInteraction, setConnectTimeout, setContentHandlerFactory, setDefaultAllowUserInteraction, setDefaultRequestProperty, setDefaultUseCaches, setDoInput, setDoOutput, setFileNameMap, setIfModifiedSince, setReadTimeout, setRequestProperty, setUseCaches, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

normaliseURL

protected static URL normaliseURL(URL url)
                           throws MalformedURLException
Throws:
MalformedURLException

getSegments

protected String[] getSegments()
Retrieve the nesting path segments.

Returns:
The segments.

getBaseResource

protected URL getBaseResource()
Retrieve the base resource URL.

Returns:
The base resource url.

connect

public void connect()
             throws IOException
Specified by:
connect in class URLConnection
Throws:
IOException
See Also:
URLConnection

setupBaseResourceInputStream

protected void setupBaseResourceInputStream()
                                     throws IOException
Setup the InputStream purely from the base resource.

Throws:
IOException - If an I/O error occurs.

setupPathedInputStream

protected void setupPathedInputStream()
                               throws IOException
Setup the InputStream for URL with nested segments.

Throws:
IOException - If an I/O error occurs.

getSegmentInputStream

protected InputStream getSegmentInputStream(InputStream baseIn,
                                            String segment)
                                     throws IOException
Retrieve the InputStream for the nesting segment relative to a base InputStream.

Parameters:
baseIn - The base input-stream.
segment - The nesting segment path.
Returns:
The input-stream to the segment.
Throws:
IOException - If an I/O error occurs.

getInputStream

public InputStream getInputStream()
                           throws IOException
Overrides:
getInputStream in class URLConnection
Throws:
IOException
See Also:
URLConnection

getJarFile

public JarFile getJarFile()
                   throws IOException
Specified by:
getJarFile in class JarURLConnection
Returns:
JarFile
Throws:
IOException
See Also:
JarURLConnection.getJarFile()