PathClassLoader.java revision a2656629522f9d79e2dca7418ab5963f50d0fda8
1/*
2 * Copyright (C) 2007 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package dalvik.system;
18
19/**
20 * Provides a simple {@link ClassLoader} implementation that operates on a list
21 * of files and directories in the local file system, but does not attempt to
22 * load classes from the network. Android uses this class for its system class
23 * loader and for its application class loader(s).
24 */
25public class PathClassLoader extends BaseDexClassLoader {
26    /**
27     * Creates a {@code PathClassLoader} that operates on a given list of files
28     * and directories. This method is equivalent to calling
29     * {@link #PathClassLoader(String, String, ClassLoader)} with a
30     * {@code null} value for the second argument (see description there).
31     *
32     * @param dexPath the list of jar/apk files containing classes and
33     * resources, delimited by {@code File.pathSeparator}, which
34     * defaults to {@code ":"} on Android
35     * @param parent the parent class loader
36     */
37    public PathClassLoader(String dexPath, ClassLoader parent) {
38        super(dexPath, null, null, null, parent);
39    }
40
41    /**
42     * Creates a {@code PathClassLoader} that operates on two given
43     * lists of files and directories. The entries of the first list
44     * should be one of the following:
45     *
46     * <ul>
47     * <li>JAR/ZIP/APK files, possibly containing a "classes.dex" file as
48     * well as arbitrary resources.
49     * <li>Raw ".dex" files (not inside a zip file).
50     * </ul>
51     *
52     * The entries of the second list should be directories containing
53     * native library files.
54     *
55     * @param dexPath the list of jar/apk files containing classes and
56     * resources, delimited by {@code File.pathSeparator}, which
57     * defaults to {@code ":"} on Android
58     * @param librarySearchPath the list of directories containing native
59     * libraries, delimited by {@code File.pathSeparator}; may be
60     * {@code null}
61     * @param parent the parent class loader
62     *
63     * This method will be deprecated in the next release
64     */
65    public PathClassLoader(String dexPath, String librarySearchPath, ClassLoader parent) {
66        super(dexPath, null, librarySearchPath, null, parent);
67    }
68
69    /**
70     * Creates a {@code PathClassLoader} that operates on two given
71     * lists of files and directories. The entries of the first list
72     * should be one of the following:
73     *
74     * <ul>
75     * <li>JAR/ZIP/APK files, possibly containing a "classes.dex" file as
76     * well as arbitrary resources.
77     * <li>Raw ".dex" files (not inside a zip file).
78     * </ul>
79     *
80     * The entries of the second list should be directories containing
81     * native library files.
82     *
83     * @param dexPath the list of jar/apk files containing classes and
84     * resources, delimited by {@code File.pathSeparator}, which
85     * defaults to {@code ":"} on Android
86     * @param librarySearchPath the list of directories containing native
87     * libraries, delimited by {@code File.pathSeparator}; may be
88     * {@code null}
89     * @param libraryPermittedPath allowing to open native libraries under
90     * directories in this list. The list is delimited by {@code File.pathSeparator}.
91     * Note that the classloader is implicitly allowed to open libraries from the
92     * directories on librarySearchPath. Directories from this list are NOT used
93     * to search for the native library; may be {@code null}
94     * @param parent the parent class loader
95     *
96     * @hide
97     */
98    public PathClassLoader(String dexPath, String librarySearchPath, String libraryPermittedPath,
99            ClassLoader parent) {
100        super(dexPath, null, librarySearchPath, libraryPermittedPath, parent);
101    }
102}
103