KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > Append


1 import jcifs.smb.SmbFile;
2 import jcifs.smb.SmbFileOutputStream;
3
4 public class Append {
5
6     public static void main( String JavaDoc argv[] ) throws Exception JavaDoc {
7
8         SmbFile f = new SmbFile( argv[0] );
9         SmbFileOutputStream out = new SmbFileOutputStream( f, true );
10
11         byte[] msg;
12         int i = 0;
13         while( i++ < 3 ) {
14             msg = new String JavaDoc( "this is msg #" + i ).getBytes();
15             out.write( msg );
16             System.out.write( msg );
17             Thread.sleep( 17000 );
18 out = new SmbFileOutputStream( f, true );
19         }
20
21         out.close();
22     }
23 }
24
Popular Tags