KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > GrowWrite


1 import jcifs.smb.SmbFile;
2 import jcifs.smb.SmbFileOutputStream;
3 import java.io.FileInputStream JavaDoc;
4
5 public class GrowWrite {
6
7     static final int SIZE = 0xFFF;
8
9     public static void main( String JavaDoc argv[] ) throws Exception JavaDoc {
10         int n, tot;
11         byte[] buf = new byte[SIZE];
12         SmbFile f = new SmbFile( argv[0] );
13         SmbFileOutputStream out = new SmbFileOutputStream( f );
14
15         n = tot = 0;
16         do {
17             if(( n % 0x1F ) == 0) {
18                 f = new SmbFile( argv[0] );
19                 out = new SmbFileOutputStream( f );
20                 System.out.print( '#' );
21             }
22             out.write( buf, 0, n );
23             out.flush();
24             tot += n;
25         } while( n++ < SIZE );
26
27         System.out.println();
28         System.out.println( tot + " bytes transfered." );
29     }
30 }
31
Popular Tags