1 import jcifs.smb.SmbFile; 2 import jcifs.smb.SmbFileOutputStream; 3 import java.io.FileInputStream ; 4 5 public class Put { 6 7 public static void main( String argv[] ) throws Exception { 8 9 SmbFile f = new SmbFile( argv[0] ); 10 FileInputStream in = new FileInputStream ( f.getName() ); 11 SmbFileOutputStream out = new SmbFileOutputStream( f ); 12 13 long t0 = System.currentTimeMillis(); 14 15 byte[] b = new byte[8192]; 16 int n, tot = 0; 17 while(( n = in.read( b )) > 0 ) { 18 out.write( b, 0, n ); 19 tot += n; 20 System.out.print( '#' ); 21 } 22 23 long t = System.currentTimeMillis() - t0; 24 25 System.out.println(); 26 System.out.println( tot + " bytes transfered in " + ( t / 1000 ) + " seconds at " + (( tot / 1000 ) / Math.max( 1, ( t / 1000 ))) + "Kbytes/sec" ); 27 28 in.close(); 29 out.close(); 30 } 31 } 32 | Popular Tags |