KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > SlowRead


1 import jcifs.smb.SmbFile;
2 import jcifs.smb.SmbFileInputStream;
3 import java.io.FileOutputStream JavaDoc;
4
5 public class SlowRead {
6
7     public static void main( String JavaDoc argv[] ) throws Exception JavaDoc {
8
9         SmbFileInputStream in = new SmbFileInputStream( argv[0] );
10
11         byte[] b = new byte[10];
12         int n, tot = 0;
13         while(( n = in.read( b )) > 0 ) {
14             System.out.write( b, 0, n );
15             tot += n;
16             Thread.sleep( 17000 );
17         }
18
19         in.close();
20     }
21 }
22
23
Popular Tags