- 1这几句话详细解释一下?
- 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);
- 2我已经传入String srcPath = args[0];String destDir = args[1];这两个参数如下:
- E:\java0108\workspace\MyEclipse 10\javaenhance\bin\cn\itcast\day2\ClassLoaderAttachment.class itcastlib
- 我怎么还抛出这个异常java.io.FileNotFoundException呢?
- */
- public class MyClassLoader extends ClassLoader{
- /**
- * @param args
- */
- public static void main(String[] args) throws Exception {
- // TODO Auto-generated method stub
- 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);
- fis.close();
- fos.close();
- }
-
- private static void cypher(InputStream ips ,OutputStream ops) throws Exception{
- int b = -1;
- while((b=ips.read())!=-1){
- ops.write(b ^ 0xff);
- }
- }
- Exception in thread "main" java.io.FileNotFoundException: E:\java0108\workspace\MyEclipse (系统找不到指定的文件。)
- at java.io.FileInputStream.open(Native Method)
- at java.io.FileInputStream.<init>(FileInputStream.java:138)
- at java.io.FileInputStream.<init>(FileInputStream.java:97)
- at cn.itcast.day2.MyClassLoader.main(MyClassLoader.java:19)
复制代码 |