Top Fields Constructors Methods
org.python.core

public Class SyspathJavaLoader

extends ClassLoader
Class Inheritance
Imports
java.io.File, .FileInputStream, .FileNotFoundException, .IOException, .InputStream, java.net.MalformedURLException, .URL, java.util.ArrayList, .Collections, .Enumeration, .List, .StringTokenizer, java.util.zip.ZipEntry, org.python.core.util.RelativeFile

Field Summary

Modifier and TypeField and Description
private static final char

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected Package
private static String
protected Class<?>
findClass(String
The binary name of the class
name
)

Overrides java.lang.ClassLoader.findClass.

Finds the class with the specified binary name.

protected URL
findResource(String
The resource name
res
)

Overrides java.lang.ClassLoader.findResource.

Finds the resource with the given name.

protected Enumeration<URL>
findResources(String
The resource name
res
)

Overrides java.lang.ClassLoader.findResources.

Returns an enumeration of URL objects representing all the resources with the given name.

private byte[]
private byte[]
private byte[]

Returns:

an array of byte[size] with the contents read
getBytesFromInputStream
(InputStream
The input stream
input
,
int
The number of bytes to read
size
)

Returns a byte[] with the contents read from an InputStream.

private File
getFile(String dir, String name)

pack-priv static PyObject
replacePathItem(PySystemState sys, int idx, PyList paths)

Inherited from java.lang.ClassLoader:
clearAssertionStatusdefineClassdefineClassdefineClassdefineClassdefinePackagefindClassfindLibraryfindLoadedClassfindResourcefindSystemClassgetClassLoadingLockgetDefinedPackagegetDefinedPackagesgetNamegetPackagegetPackagesgetParentgetPlatformClassLoadergetResourcegetResourceAsStreamgetResourcesgetSystemClassLoadergetSystemResourcegetSystemResourceAsStreamgetSystemResourcesgetUnnamedModuleisRegisteredAsParallelCapableloadClassloadClassregisterAsParallelCapableresolveClassresourcessetClassAssertionStatussetDefaultAssertionStatussetPackageAssertionStatussetSigners

Field Detail

SLASH_CHARback to summary
private static final char SLASH_CHAR

Constructor Detail

SyspathJavaLoaderback to summary
public SyspathJavaLoader(ClassLoader parent)

Method Detail

definePackageForClassback to summary
protected Package definePackageForClass(String name)
deslashResourceback to summary
private static String deslashResource(String res)
findClassback to summary
protected Class<?> findClass(String name) throws ClassNotFoundException

Overrides java.lang.ClassLoader.findClass.

Doc from java.lang.ClassLoader.findClass.

Finds the class with the specified binary name. This method should be overridden by class loader implementations that follow the delegation model for loading classes, and will be invoked by the loadClass method after checking the parent class loader for the requested class.

Parameters
name:String

The binary name of the class

Returns:Class<?>

The resulting Class object

Annotations
@Override
Exceptions
ClassNotFoundException:
If the class could not be found

findResourceback to summary
protected URL findResource(String res)

Overrides java.lang.ClassLoader.findResource.

Doc from java.lang.ClassLoader.findResource.

Finds the resource with the given name. Class loader implementations should override this method.

For resources in named modules then the method must implement the rules for encapsulation specified in the Module getResourceAsStream method. Additionally, it must not find non-".class" resources in packages of named modules unless the package is opened unconditionally.

Parameters
res:String

The resource name

Returns:URL

URL object for reading the resource; null if the resource could not be found, a URL could not be constructed to locate the resource, the resource is in a package that is not opened unconditionally, or access to the resource is denied by the security manager.

Annotations
@Override

findResourcesback to summary
protected Enumeration<URL> findResources(String res) throws IOException

Overrides java.lang.ClassLoader.findResources.

Doc from java.lang.ClassLoader.findResources.

Returns an enumeration of URL objects representing all the resources with the given name. Class loader implementations should override this method.

For resources in named modules then the method must implement the rules for encapsulation specified in the Module getResourceAsStream method. Additionally, it must not find non-".class" resources in packages of named modules unless the package is opened unconditionally.

Parameters
res:String

The resource name

Returns:Enumeration<URL>

An enumeration of URL objects for the resource. If no resources could be found, the enumeration will be empty. Resources for which a URL cannot be constructed, are in a package that is not opened unconditionally, or access to the resource is denied by the security manager, are not returned in the enumeration.

Annotations
@Override
Exceptions
IOException:
If I/O errors occur

getBytesFromArchiveback to summary
private byte[] getBytesFromArchive(SyspathArchive archive, String name)
getBytesFromDirback to summary
private byte[] getBytesFromDir(String dir, String name)
getBytesFromInputStreamback to summary
private byte[] getBytesFromInputStream(InputStream input, int size)

Returns a byte[] with the contents read from an InputStream. The stream is closed after reading the bytes.

Parameters
input:InputStream

The input stream

size:int

The number of bytes to read

Returns:byte[]

an array of byte[size] with the contents read

getFileback to summary
private File getFile(String dir, String name)
replacePathItemback to summary
pack-priv static PyObject replacePathItem(PySystemState sys, int idx, PyList paths)