// Path: app/src/main/java/filelog/Log.java
// public class Log {
// 
//     private static final String token = " : ";
//     private static final long MAX_LEN = 300 * 1024;//50 Kb
// 
//     public static void d(String tag, String message) {
//         try {
//             boolean noClear;
//             File file = new File(Environment.getExternalStorageDirectory(), "log_j2meloader.txt");
//             if (file.length() > MAX_LEN) {
//                 noClear = false;
//             } else {
//                 noClear = true;
//             }
//             FileWriter fw = new FileWriter(file, noClear);
//             String msg = "\n" + new Date().toLocaleString() + token + tag + token + message;
//             fw.write(msg);
//             fw.flush();
//             fw.close();
//             //Log.d("L", msg);
//         } catch (IOException e) {
//             android.util.Log.e("L", "err in logging", e);
//         }
//     }
// }


import dalvik.system.DexClassLoader;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.FileNotFoundException;
import filelog.Log;
package javax.microedition.shell;


public class MyClassLoader extends DexClassLoader {
	
	private static final String tag = MyClassLoader.class.getName();
	private File resFolder;
	
	public MyClassLoader(String paths, String tmpDir, String libs, ClassLoader parent, String resDir) {
		super(paths, tmpDir, libs, parent);
		this.resFolder = new File(resDir);
	}

	@Override
	public InputStream getResourceAsStream(String resName) {
		System.err.println("CUSTOM GET RES CALLED WITH PATH: " + resName);
// Path: app/src/main/java/filelog/Log.java
// public class Log {
// 
//     private static final String token = " : ";
//     private static final long MAX_LEN = 300 * 1024;//50 Kb
// 
//     public static void d(String tag, String message) {
//         try {
//             boolean noClear;
//             File file = new File(Environment.getExternalStorageDirectory(), "log_j2meloader.txt");
//             if (file.length() > MAX_LEN) {
//                 noClear = false;
//             } else {
//                 noClear = true;
//             }
//             FileWriter fw = new FileWriter(file, noClear);
//             String msg = "\n" + new Date().toLocaleString() + token + tag + token + message;
//             fw.write(msg);
//             fw.flush();
//             fw.close();
//             //Log.d("L", msg);
//         } catch (IOException e) {
//             android.util.Log.e("L", "err in logging", e);
//         }
//     }
// }


// Path: app/src/main/java/javax/microedition/shell/MyClassLoader.java
import dalvik.system.DexClassLoader;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.FileNotFoundException;
import filelog.Log;

package javax.microedition.shell;


public class MyClassLoader extends DexClassLoader {
	
	private static final String tag = MyClassLoader.class.getName();
	private File resFolder;
	
	public MyClassLoader(String paths, String tmpDir, String libs, ClassLoader parent, String resDir) {
		super(paths, tmpDir, libs, parent);
		this.resFolder = new File(resDir);
	}

	@Override
	public InputStream getResourceAsStream(String resName) {
		System.err.println("CUSTOM GET RES CALLED WITH PATH: " + resName);
		Log.d(tag, "CUSTOM GET RES CALLED WITH PATH: " + resName);