home *** CD-ROM | disk | FTP | other *** search
/ Freelog Special Freeware 25 / FreelogHS25.iso / Dessin / ArtOfIllusion2.2.1 / ArtOfIllusion.jar / bsh / commands / cp.bsh < prev    next >
Text File  |  2005-05-23  |  474b  |  21 lines

  1. /**
  2.     Copy a file (like Unix cp).
  3. */
  4.  
  5. bsh.help.cp = "usage: cp( fromFile, toFile )";
  6.  
  7. cp( String fromFile, String toFile ) 
  8. {
  9.     this.from = pathToFile( fromFile );
  10.     this.to = pathToFile( toFile );
  11.  
  12.     this.in = new BufferedInputStream( new FileInputStream( from ) );
  13.     this.out = new BufferedOutputStream( new FileOutputStream( to ) );
  14.     byte [] buff = new byte [ 32*1024 ];
  15.     while ( (len = in.read( buff )) > 0 )
  16.             out.write( buff, 0, len );
  17.     in.close();
  18.     out.close();
  19. }
  20.  
  21.