Class NonLockingJarUrlConnection
java.lang.Object
java.net.URLConnection
java.net.JarURLConnection
org.codehaus.classworlds.uberjar.protocol.jar.NonLockingJarUrlConnection
This is copied from Classwords 1.1 org.codehaus.classworlds.uberjar.protocol.jar.JarURLConnection
so that an additional dependency does not need to be added to plugins. The formatting is left as is to reduce
the diff.
The setupPathedInputStream() method has been modified to improve the speed of resource lookups. It now uses a ZipEntry to get random access to entries in the JAR.
This change removes the ability for this connection class to load resources from JARs nested inside the outer
JAR. This is not used in atlassian-plugin because the inner JAR loading is handled by
PluginClassLoader.
-
Field Summary
Fields inherited from class java.net.JarURLConnection
jarFileURLConnectionFields inherited from class java.net.URLConnection
allowUserInteraction, connected, doInput, doOutput, ifModifiedSince, url, useCaches -
Method Summary
Modifier and TypeMethodDescriptionvoidconnect()protected URLRetrieve the base resourceURL.protected InputStreamgetSegmentInputStream(InputStream baseIn, String segment) Retrieve theInputStreamfor the nesting segment relative to a baseInputStream.protected String[]Retrieve the nesting path segments.protected static URLnormaliseURL(URL url) protected voidSetup theInputStreampurely from the base resource.protected voidSetup theInputStreamfor URL with nested segments.Methods inherited from class java.net.JarURLConnection
getAttributes, getCertificates, getEntryName, getJarEntry, getJarFileURL, getMainAttributes, getManifestMethods inherited from class java.net.URLConnection
addRequestProperty, getAllowUserInteraction, getConnectTimeout, getContent, getContent, getContentEncoding, getContentLength, getContentLengthLong, getContentType, getDate, getDefaultAllowUserInteraction, getDefaultRequestProperty, getDefaultUseCaches, getDefaultUseCaches, getDoInput, getDoOutput, getExpiration, getFileNameMap, getHeaderField, getHeaderField, getHeaderFieldDate, getHeaderFieldInt, getHeaderFieldKey, getHeaderFieldLong, getHeaderFields, getIfModifiedSince, getLastModified, getOutputStream, getPermission, getReadTimeout, getRequestProperties, getRequestProperty, getURL, getUseCaches, guessContentTypeFromName, guessContentTypeFromStream, setAllowUserInteraction, setConnectTimeout, setContentHandlerFactory, setDefaultAllowUserInteraction, setDefaultRequestProperty, setDefaultUseCaches, setDefaultUseCaches, setDoInput, setDoOutput, setFileNameMap, setIfModifiedSince, setReadTimeout, setRequestProperty, setUseCaches, toString
-
Method Details
-
normaliseURL
- Throws:
MalformedURLException
-
getSegments
Retrieve the nesting path segments.- Returns:
- The segments.
-
getBaseResource
Retrieve the base resourceURL.- Returns:
- The base resource url.
-
connect
- Specified by:
connectin classURLConnection- Throws:
IOException- See Also:
-
setupBaseResourceInputStream
Setup theInputStreampurely from the base resource.- Throws:
IOException- If an I/O error occurs.
-
setupPathedInputStream
Setup theInputStreamfor URL with nested segments.- Throws:
IOException- If an I/O error occurs.
-
getSegmentInputStream
Retrieve theInputStreamfor the nesting segment relative to a baseInputStream.- 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
- Overrides:
getInputStreamin classURLConnection- Throws:
IOException- See Also:
-
getJarFile
- Specified by:
getJarFilein classJarURLConnection- Returns:
- JarFile
- Throws:
IOException- See Also:
-