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 17 package 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 */ 25 public 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 */ PathClassLoader(String dexPath, ClassLoader parent)37 public PathClassLoader(String dexPath, ClassLoader parent) { 38 super(dexPath, 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 */ PathClassLoader(String dexPath, String librarySearchPath, ClassLoader parent)63 public PathClassLoader(String dexPath, String librarySearchPath, ClassLoader parent) { 64 super(dexPath, null, librarySearchPath, parent); 65 } 66 } 67