A股上市公司传智教育(股票代码 003032)旗下技术交流社区北京昌平校区

 找回密码
 加入黑马

QQ登录

只需一步,快速开始

© 谢波 中级黑马   /  2013-2-7 21:41  /  1338 人查看  /  3 人回复  /   0 人收藏 转载请遵从CC协议 禁止商业使用本文

  1. package mypackage;

  2. import java.io.File;
  3. import java.io.FileInputStream;
  4. import java.io.FileOutputStream;
  5. import java.io.InputStream;

  6. import org.omg.CORBA_2_3.portable.OutputStream;

  7. public class ClassLoaderTest {

  8.         /**
  9.          * @param args
  10.          */
  11.         public static void main(String[] args) throws Exception{
  12.                 File srcFile = new File(args[0]);
  13.                 File destDir = new File(args[1]);
  14.                
  15.                 FileInputStream fis = new FileInputStream(srcFile);
  16.                 File destFile = new File(destDir,srcFile.getName());
  17.                 FileOutputStream fos = new FileOutputStream(destFile);

  18.                 cypher(fis,fos);//编译不能通过,为什么呢?不是多态吗?求解
  19.         }
  20.         private static void cypher(InputStream is,OutputStream os)throws Exception
  21.         {
  22.                 int b = -1;
  23.                 while((b=is.read())!=-1)
  24.                         os.write(b ^ 0xff);   
  25.                 is.close();
  26.                 os.close();
  27.         }

  28. }
复制代码

3 个回复

倒序浏览
兄弟,OutputStream你的包导错了 import org.omg.CORBA_2_3.portable.OutputStream; 应该导入java.io.OutputStream.
回复 使用道具 举报
{:soso_e127:}谢谢了
晕死
看来 真是老了  
回复 使用道具 举报
同学,File类有构造函数可以接受数组的?
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 加入黑马