本帖最后由 樊其杰 于 2013-5-22 16:32 编辑
ClassLoaderAttachment类代码如下:- package cn.itcast.day2;
- import java.util.Date;
- public class ClassLoaderAttachment extends Date {
- @Override
- public String toString() {
- return "hello itcast";
- }
- }
复制代码 MyClassLoader类代码如下:- package cn.itcast.day2;
- /**
- * 加密程序
- */
- import java.io.*;
- public class MyClassLoader {
- 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);
- fos.close();
- fis.close();
- }
- public static void cypher(InputStream ins,OutputStream outs)throws Exception{
- int b=0;
- while((b=ins.read())!=-1){
- outs.write(b^0xff);
- }
- }
- }
复制代码 程序运行输入截图如下:
为什么运行时出错?Exception in thread "main" java.io.FileNotFoundException: E:\Workspaces\MyEclipse (系统找不到指定的文件。)?
|
|