文章来源:黑马程序员,黑马论坛
|
import java.io.ByteArrayOutputStream;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
public class MyClassLoader extends ClassLoader{
public static void main(String[] args) throws Exception {
String srcPath=args[0];
String destDir=args[1];
FileInputStream fis=new FileInputStream(srcPath);
String destFileName=srcPath.substring(srcPath.lastIndexOf(
'\\')+1);
String destPath=destDir+"\\"+destFileName;
FileOutputStream fos=new FileOutputStream(destPath);
cypher(fis,fos);
}
public static void cypher(FileInputStream ips, FileOutputStream ops) throws Exception {
int b=-1;
while ((b=ips.read())!=-1) {
ops.write(b ^ 0xff);
}
}
import java.util.Date;
public class ClassLoaderAttachment extends Date {
public String toString(){
return "hello,itcast";
}
}